seany123 Posted September 18, 2008 Share Posted September 18, 2008 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 More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 $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 } Link to comment https://forums.phpfreaks.com/topic/124742-help-with-database-work/#findComment-644351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.