mysql UPDATE only partially being performed

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
steve9876
Forum Newbie
Posts: 13
Joined: Tue Jul 21, 2009 7:34 pm

mysql UPDATE only partially being performed

Post 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?
infiniteacuity
Forum Newbie
Posts: 12
Joined: Tue Jun 16, 2009 2:48 pm
Location: Ft. Lauderdale

Re: mysql UPDATE only partially being performed

Post by infiniteacuity »

What is the field type of OrderStatus?
steve9876
Forum Newbie
Posts: 13
Joined: Tue Jul 21, 2009 7:34 pm

Re: mysql UPDATE only partially being performed

Post by steve9876 »

It's CHAR size 10.
Post Reply