#1
|
|||
|
|||
MySQL queries ..?
I've recently constructed my own store and currency system from scratch, with the help from a few tutorials and careful examination of Brandon's script of course. I've gotten as far as the currency, store and store adoption process - heck, everything's working except one tiny simple thing: updating the user's money once s/he buys something!
I even went as far as examining the old easyadopts store mod to see how they did it, then duplicated it, and still nothing? I'm certain it's something simple, perhaps the placement of the code or a missing quotation mark, but here it is: Code:
else{ // The adoptable ID appears to be valid, so we need to double check that it is valid by pulling up the adoptable in the DB $query = "SELECT * FROM ".$prefix."store WHERE id='$id'"; $result = mysql_query($query); $num = mysql_numrows($result); //Loop out code $i=0; while ($i < 1) { $aid=@mysql_result($result,$i,"id"); //The adoptable's ID $type=@mysql_result($result,$i,"name"); $description=@mysql_result($result,$i,"description"); $eggimage=@mysql_result($result,$i,"eggimage"); $clixprice=@mysql_result($result,$i,"clixprice"); $cashprice=@mysql_result($result,$i,"cashprice"); $query2 = "SELECT * FROM ".$prefix."users WHERE username='$loggedinname'"; $result2 = mysql_query($query2); $num2 = mysql_numrows($result2); $clix=@mysql_result($result2,$i,"clix"); $cash=@mysql_result($result2,$i,"cash"); if($_GET["payclix"]) { $newclix = $clix - $clixprice; mysql_query("UPDATE users SET clix = '".$newclix."' WHERE username = '$loggedinname'"); $i++; echo "clix: $clix balance: $newclix price: $clixprice name: $loggedinname"; } elseif($_GET["paycash"]) { $newcash = $cash - $cashprice; mysql_query("UPDATE users SET cash = '".$newcash."' WHERE username = '$loggedinname'"); $i++; echo "cash: $cash balance: $newcash price: $cashprice name: $loggedinname"; } $i++; } Unfortunately you won't see it uploaded as a mod for two reasons: 1) It's very Arvyre-specific 2) There are so many small changes to the script I couldn't possibly deconstruct it..! Sorry. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Troubles with queries | pachoofoosh | Questions and Supports | 4 | 08-05-2013 11:32 AM |
Question about Queries? | Tsuntsun | Questions and Supports | 2 | 11-03-2011 01:57 PM |
MySQL: What to do? | Knyfe | Questions and Supports | 18 | 03-11-2011 12:52 PM |
Anyone care to enlighten me as to why 188 queries are used on a page? | Arianna | Questions and Supports | 5 | 05-14-2010 09:21 AM |
mySQL help | aroymart | Questions and Supports | 4 | 04-20-2009 12:13 AM |
What's New? |
What's Hot? |
What's Popular? |