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
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
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.