Jump to content

Spend 'money' to buy 'points'


mastercjb

Recommended Posts

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

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.");
}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.