I have a database with the field Unique ID, which has two rows in it, both integers. The first row has value 3 and the second row 4. The aim of this script is to find the one with the highest value, but it only echo's "Unique ID".
Here is the code:
<?php
$connection = mysql_connect("localhost","root");
if(!$connection) {
die("Connection Failed" . mysql_error());
}
mysql_select_db("rewiredstate",$connection);
$max="SELECT MAX('Unique ID') as id FROM topics";
$maxquery= mysql_query($max) or die (mysql_error());
while($row = mysql_fetch_assoc($maxquery)) {
echo $row['id'];
}
?>
Does anyone have any ideas as to what might be wrong with it? Any help would be greatly appreciated. Thanks
mysqliorPDO, because themysql_functions will be deprecated soon.