I'm working on a small project: a small number crunching game.
I want to have a php file that can accept inputs and interpret them into specified database updates.
Here is what I have so far. It doesn't seem to be working for me.
$name = $_GET['n'];
$action = $_GET['a'];
$result = mysql_query("SELECT * FROM players WHERE Username ='".$name."'");
while($row = mysql_fetch_array($result)) {
if ($action = "rankup") mysql_query("UPDATE players SET Level 'Level+1' WHERE Username='".$name."'");
}
mysql_close($con);
I'm not getting any errors, but its not working, and all the database connections are fine.
I dont know what the problem is.
mysql_real_escape_string($_GET['foo'])for every user input you pass to the DB. Second, you should use the more "modern" way of accessing the DB with PHPPDO(see php.net/pdo).SET Level=Level+1?