# Simple Search/return data/use data query

**URL:** <https://www.phphelp.com/t/simple-search-return-data-use-data-query/22009>\
**Category:** General Database (Oracle, SQL Server, etc)\
**Created:** [January 31, 2014, 12:04pm UTC](https://www.phphelp.com/t/simple-search-return-data-use-data-query/22009 "2014-01-31T12:04:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://www.phphelp.com/uploads/default/original/2X/2/243e9ed5d93c5653ce3186f18df16e019ce38445.png) [@system](https://www.phphelp.com/u/system)\
**Post date:** [January 31, 2014, 12:04pm UTC](https://www.phphelp.com/t/simple-search-return-data-use-data-query/22009/1 "2014-01-31T12:04:11Z")

</div>

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

```auto
$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 SQL console via mySQL web access (with static values for player\_id=/name= etc.), does nothing. (Example trying to set a value in a table. Works in SQL web access, but not via php scripts)

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [January 31, 2014, 7:00pm UTC](https://www.phphelp.com/t/simple-search-return-data-use-data-query/22009/2 "2014-01-31T19:00:23Z")

</div>

Look at your select query and your update and find the difference in the variable usage.
