You need to separate the SET arguments with commas, not ANDs... It's really doing something like this: UPDATE shop_customer SET eu_vat_number = ("SK1234567890" AND vat_amount = 0 AND total_amount = 8.4925) WHERE customer_id = 7 AND hash="dcd5e751" ("SK1234567890" AND vat_amount = 0 AND total_amount = 8.4925) evaluates to false (0) , so that's what gets set. Kevin Davies - Bonhurst Consulting wrote:
Hi, Apologies if this isn't the right place to ask - but I'm banging my head against the wall with this one! I'm trying to update a record in the table (creation script below) using the following SQL statement: UPDATE shop_customer SET eu_vat_number = "SK1234567890" AND vat_amount = 0 AND total_amount = 8.4925 WHERE customer_id = 7 AND hash="dcd5e751" Before running the query the value for eu_vat_number is 'null', vat_amount is 0.085 and total_amount = 8.5775. After I run the query (mysql_affected_rows = 1) the values for vat_amount and total_amount remain the same, but vat_number is changed to 0. I've been looking at this most of the afternoon, and it's probably something really simple but I just can't see it... Any ideas? Thanks in advance for your help... Cheers, Kev -- Server version: 3.23.58 -- PHP Version: 4.3.10 CREATE TABLE `shop_customer` ( `customer_id` int(11) NOT NULL auto_increment, `hash` varchar(8) NOT NULL default '', `first_name` varchar(255) NOT NULL default '', `last_name` varchar(255) NOT NULL default '', `email_address` varchar(255) NOT NULL default '', `member_id` int(11) default NULL, `address1` varchar(255) default NULL, `address2` varchar(255) default NULL, `town` varchar(255) default NULL, `county` varchar(255) default NULL, `postcode` varchar(255) default NULL, `country` int(11) NOT NULL default '0', `eu_vat_number` varchar(15) default NULL, `total_items` int(11) default '0', `net_amount` float default '0', `vat_amount` float default '0', `shipping_amount` float default '0', `total_amount` float default '0', `added` datetime NOT NULL default '0000-00-00 00:00:00', `payment_received` datetime default NULL, PRIMARY KEY (`customer_id`) ) TYPE=MyISAM AUTO_INCREMENT=8 ;
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php