I have a database with some rows.. hehe
One row contains a base64 encoded name, and another contains a number, bigint(20).
I run two selection statements in phpmysql, and I get the values I want.. when I run the same from a .php I get only errors.
Here is what i run in phpmysql:
1: select max(rating) from players
This gives me 8146
2: select name from players where rating=8146
This gives me Name
Here is the code that i try to run from the .php I am fiddling with:
// getting data from the database //
$query1="select max(rating)from dfbhd_players";
$query = "select * from dfbhd_players where rating = $query1";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_object($result)) {
echo base64_decode($row->name);
}
/ Free resultset /
mysql_free_result($result);
/ Closing connection /
mysql_close($db);
This returns
Query failed : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select max(rating)from dfbhd_players' at line 1