Page 1 of 1

mysql UPDATE only partially being performed

Posted: Mon Aug 10, 2009 12:56 am
by steve9876
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?

Re: mysql UPDATE only partially being performed

Posted: Mon Aug 10, 2009 2:53 pm
by infiniteacuity
What is the field type of OrderStatus?

Re: mysql UPDATE only partially being performed

Posted: Mon Aug 10, 2009 6:02 pm
by steve9876
It's CHAR size 10.