Hello,
I'm having a problem when trying to update a record. I'm trying to set a
field called 'balance' to 0 but instead of 'balance' becoming 0 the
field 'name' becomes 0. None of the other columns are updated
incorrectly.
Here's the SQL statement I'm using:
UPDATE `users`
SET `name` = 'First Last'
AND `email` = 'flast@stripped'
AND `balance` = 0
AND `accrual` = 14400
AND `is_manager` = 1
AND `is_superadmin` = 1
AND `type` = 0
AND `manager_id` = 0
AND `modified` = NOW()
WHERE `id` = 5
Here's the table definition:
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`email` varchar(255) NOT NULL default '',
`password` varchar(32) NOT NULL default '',
`type` tinyint(3) unsigned NOT NULL default '0',
`manager_id` int(10) unsigned NOT NULL default '0',
`is_manager` tinyint(1) NOT NULL default '0',
`is_superadmin` tinyint(1) NOT NULL default '0',
`fulltime_start` date NOT NULL default '0000-00-00',
`accrual` smallint(6) NOT NULL default '0',
`balance` mediumint(9) NOT NULL default '0',
`created` datetime NOT NULL default '0000-00-00 00:00:00',
`modified` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
I did an experiment just now through phpMyAdmin with the following query
and it worked as expected:
UPDATE `users`
SET `balance` = 0
WHERE `id` = 5
Only thing I can guess is that there's an obvious error that is not
obvious to me. :)
Thanks,
Chris.