php not actually running queries? Simple search, store results, update


Trying to simply add 10k to the player balance on a minecraft server that uses a 2 tables for currency: 1 that contains the username and id. 2. contains the amount and id. They are linked together via the id, so I have to search for it first via name before I can update the balance via ID. Some names have been changed for security.

$result = mysql_query("SELECT id FROM sometable WHERE name = '".$minecraft_name."'");
while($wallet = mysql_fetch_row($result))
mysql_query("UPDATE someOTHERtable SET balance=balance+10000 WHERE (player_id='"$wallet"') AND (money_id='1')");

I get errors from php:
PHP Parse error: syntax error, unexpected T_STRING in /file/

Also upon just running this UPDATE query via php that runs perfectly fine in the phpmyadmin(with static values for player_id=/name= etc.), does nothing. (Example trying to set a value in a table. Works in phpmyadmin, but not via php scripts)


You’re missing a " at the end of the update query


That actually made it error out.

The script doesn’t give errors anymore, but it doesn’t actually update the table even when ignoring variables in the code and using plain numbers.

here is the current code (area of interest):

$result = mysql_query("SELECT * FROM account_table WHERE name = '".$minecraft_name."'");
$wallet = mysql_fetch_row($result);
$walletid = $wallet["walletid"];
mysql_query("UPDATE balance_table SET balance=balance+10000 WHERE (username_id='".$walletid."') AND (currency_id='1')");