I know that this is dozy, but getting to the end of my tether, this should work, but I can't see why I can't place the first value of my order table into the variable order_id, can anyone see my mistake?
Thanks
$con = mysql_connect("localhost", "tim", "password");
if (!$con) {
die('Could not connect: '.mysql_error());
}
$sql = "SELECT TOP 1 order_order_id FROM tbl_order ORDER BY order_id DESC";
$result = mysql_query($sql, $con);
while ($rows = mysql_fetch_array($result)) {
$order_id = $rows;
}
Use this code and let me know if it works:
$con = mysql_connect("localhost","tim","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$sql = "SELECT TOP 1 order_order_id FROM tbl_order ORDER BY order_id DESC";
$result = mysql_query($sql,$con);
if (mysql_num_rows($result)) {
$rows = mysql_fetch_assoc($result);
$order_id = $rows['order_order_id'];
} else {
die('No order ID found');
}