Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-11-2009, 05:41 AM
Quillink Quillink is offline
Member
 
Join Date: Dec 2008
Posts: 93
Credits: 12,804
Quillink
Lightbulb 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++;
}
This is from a duplicated, modified version of 'doadopt.php', and I know the scripting is very nooby, I just picked it up over the past two weeks. Please point out any other problems if you see them! ;)

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.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -5. The time now is 03:07 PM.

Currently Active Users: 1797 (0 members and 1797 guests)
Threads: 4,081, Posts: 32,025, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636