I know this is very silly question. But I am disappointed with the behaviour of this query. I am updating Customers in Opencart. When I have written and executed an Update query, few fields are being inserted and few are not. Especially I need to update 'status' and 'approved' columns. Please check the below Query.
UPDATE oc_customer SET customer_group_id=1,store_id=0,firstname='',lastname='HEATHER HUME',telephone='9876543210',fax='0',password='f53cbb1352950831a84035d320063383f345cfce',salt='rCF2EquoV',status='1',approved='1',date_added='2016-08-31',discount=62.00 WHERE customer_id='1418'
Please let me know what is wrong with this. It is updating Telephone column and not status,approved.
Below is the structure of my table
CREATE TABLE IF NOT EXISTS `oc_customer` (
`customer_id` int(11) NOT NULL,
`customer_group_id` int(11) NOT NULL,
`store_id` int(11) NOT NULL DEFAULT '0',
`firstname` varchar(32) NOT NULL,
`lastname` varchar(32) NOT NULL,
`email` varchar(96) NOT NULL,
`telephone` varchar(32) NOT NULL,
`cellphone` varchar(32) NOT NULL,
`fax` varchar(32) NOT NULL,
`password` varchar(40) NOT NULL,
`salt` varchar(9) NOT NULL,
`cart` text,
`wishlist` text,
`newsletter` tinyint(1) NOT NULL DEFAULT '0',
`address_id` int(11) NOT NULL DEFAULT '0',
`custom_field` text NOT NULL,
`ip` varchar(40) NOT NULL,
`status` tinyint(1) NOT NULL,
`approved` tinyint(1) NOT NULL,
`safe` tinyint(1) NOT NULL,
`token` text NOT NULL,
`date_added` datetime NOT NULL,
`discount` decimal(8,2) NOT NULL DEFAULT '0.00',
`tax_id` varchar(50) NOT NULL,
`subscribe` varchar(5) NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=1419 DEFAULT CHARSET=utf8;
My php code is
$query = "UPDATE oc_customer SET customer_group_id=1,store_id=0,firstname='$first_name',lastname='$last_name',telephone='$phone',fax='$fax',password='$password',salt='$salt',status=".(int)$status.",approved=".(int)$approved.",date_added='$date_added1',discount=$discount WHERE customer_id='$customer_id' ";
mysqli_query($con,$query);
$con is my connection variable.No problem with that.