Jump to content

help with database work.


seany123

Recommended Posts

Okay so for my game i have many different Houses people can buy and move into.

What i need help with is how do i make it so when i click on the link to buy a house...

 

It takes away 10000 'gold' from 'players' table, it makes the 'maxawake' go up to 210 in the 'players' table but at the same time makes the 'awake' go down to 0 in 'players' table.

 

also if the player doesnt have 10000 gold then it says a error message.

 

can anyone tell me the code snippets needed for this?

Link to comment
https://forums.phpfreaks.com/topic/124742-help-with-database-work/
Share on other sites

$query = "SELECT gold FROM players WHERE player_id = $id"
----- add your db stuff here -----
if ($gold<10000) echo "Not enough gold...";
else{
  $updatequery = "UPDATE players SET gold = (gold-10000), maxawake = 210, awake = 0 WHERE player_id = $id";
  -- run your query and stuff
}

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.