mysql UPDATE only partially being performed
Posted: Mon Aug 10, 2009 12:56 am
A mysql UPDATE command is updating some fields but not others.
The PHP code is
if ($OrderStatus == 'PAID')
{$UpdateRecord = "UPDATE Orders SET ";
$UpdateRecord .= "OrderStatus = 'DOWNLOADED'";
$UpdateRecord .= ", DownloadDate = '" . date('Ymd');
$UpdateRecord .= "', DownloadTime = '" . date('H:i:s');
$UpdateRecord .= "' WHERE OrderNo = '" . $OrdNo . "'";
echo "Update String = " . $UpdateRecord ."<br>";
mysql_query($UpdateRecord);
};
and the resulting command is
Update String = UPDATE Orders SET OrderStatus = 'DOWNLOADED', DownloadDate = '20090809', DownloadTime = '22:36:50' WHERE OrderNo = '228580'
OrderStatus is not being set to 'DOWNLOADED' (it stays 'PAID'), but DownloadDate and DownloadTime are being set, so the instruction is being executed.
Can anyone see why this would be?
The PHP code is
if ($OrderStatus == 'PAID')
{$UpdateRecord = "UPDATE Orders SET ";
$UpdateRecord .= "OrderStatus = 'DOWNLOADED'";
$UpdateRecord .= ", DownloadDate = '" . date('Ymd');
$UpdateRecord .= "', DownloadTime = '" . date('H:i:s');
$UpdateRecord .= "' WHERE OrderNo = '" . $OrdNo . "'";
echo "Update String = " . $UpdateRecord ."<br>";
mysql_query($UpdateRecord);
};
and the resulting command is
Update String = UPDATE Orders SET OrderStatus = 'DOWNLOADED', DownloadDate = '20090809', DownloadTime = '22:36:50' WHERE OrderNo = '228580'
OrderStatus is not being set to 'DOWNLOADED' (it stays 'PAID'), but DownloadDate and DownloadTime are being set, so the instruction is being executed.
Can anyone see why this would be?