bunny1
03-07-2007, 11:40 PM
Hi
Im trying to find the highest id in the primary key Product_ID in the database and assign it to a variable.
The sql brings back the correct result
But when i use it in php i get no result
Can anyone see whats wrong with this code??
Thanks
$query = "SELECT max(Product_ID) as MaxID from Prods";
$result = @mysql_query($query) or die(mysql_error());
while($row = @mysql_fetch_array($result))
{
echo $row['Product_ID'];
}
Im trying to find the highest id in the primary key Product_ID in the database and assign it to a variable.
The sql brings back the correct result
But when i use it in php i get no result
Can anyone see whats wrong with this code??
Thanks
$query = "SELECT max(Product_ID) as MaxID from Prods";
$result = @mysql_query($query) or die(mysql_error());
while($row = @mysql_fetch_array($result))
{
echo $row['Product_ID'];
}