Hi there,
I'm build an online game website, and i'm having a bit of trouble getting something to work right. It's a PHP form.
Basically, the idea is that a user can buy "credits" which allows them to make them stronger and better than other players.
The problem I'm having is that when a user buys credits, it not only gives that user credits, but it also gives every other user in the database the same amount of credits.
So if one user buys 100 credits, all users get 100 credits.
So I tried using the WHERE clause, but didn't get anywhere with it.
So I thought of another idea, using a form which asked the user to type in their username and that would add 100 credits to that username.
Here is the code i'm working with:
<form action="called.php" method="post">
Username<input type="text" name="usernamecalled" />
<input type="submit" value="Add Credits!" />
</form>
<?php
mysql_query("UPDATE `game_planets.belcredits` SET `game_planets.belcredits` = `game_planets.belcredits`+'100' WHERE `game_users.username` = 'usernamecalled'");
?>
I can't seem to get the form to work right, can anyone point me in the right direction? Many thanks!