mastercjb Posted May 10, 2009 Share Posted May 10, 2009 I'm adding a market on my game where you can spend cash and points to buy things, now I have been trying to write a code to spend money to buy points. Heres the code used for spending points to buy other things like hp, nerve, energy, all in the users parts of my database. if ($_GET['spend'] == "nerve"){ if($user_class->points > 9) { $newpoints = $user_class->points - 10; $result = mysql_query("UPDATE `grpgusers` SET `nerve` = '".$user_class->maxnerve"', `points`='".$newpoints."' WHERE `id`='".$_SESSION['id']."'"); echo Message("You spent $2,000,000 and bought 100 Points!."); } else { echo Message("You don't have enough Cash, silly buns."); } } Link to comment https://forums.phpfreaks.com/topic/157546-spend-money-to-buy-points/ Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 And the problem is...? Link to comment https://forums.phpfreaks.com/topic/157546-spend-money-to-buy-points/#findComment-830664 Share on other sites More sharing options...
mastercjb Posted May 10, 2009 Author Share Posted May 10, 2009 I'm adding a market on my game where you can spend cash and points to buy things, now I have been trying to write a code to spend money to buy points. Heres the code used for spending points to buy other things like hp, nerve, energy, all in the users parts of my database. if ($_GET['spend'] == "nerve"){ if($user_class->points > 9) { $newpoints = $user_class->points - 10; $result = mysql_query("UPDATE `grpgusers` SET `nerve` = '".$user_class->maxnerve"', `points`='".$newpoints."' WHERE `id`='".$_SESSION['id']."'"); echo Message("You spent $2,000,000 and bought 100 Points!."); } else { echo Message("You don't have enough Cash, silly buns."); } } Ment to add this lol: This is the code I tried to make for it however, I get this. Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/www/mafiarevived.awardspace.us/spendpoints.php on line 15 Maybe its because I'm not sure if ADD is even a command, also not sure if 100points would be there lol... if ($_GET['spend'] == "points"){ if($user_class->money > 9) { $newmoney = $user_class->money - 2000000; $result = mysql_query("UPDATE `grpgusers` ADD `points` = '".$user_class->100points"', `money`='".$newmoney."' WHERE `id`='".$_SESSION['id']."'"); echo Message("You spent $2,000,000 and bought 100 Points!."); } else { echo Message("You don't have enough Cash, silly buns."); } } Link to comment https://forums.phpfreaks.com/topic/157546-spend-money-to-buy-points/#findComment-830679 Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 $result = mysql_query("UPDATE `grpgusers` `points` = `points` + ".$user_class->100points", `money`='".$newmoney."' WHERE `id`='".$_SESSION['id']."'"); Link to comment https://forums.phpfreaks.com/topic/157546-spend-money-to-buy-points/#findComment-830681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.