[eluser]Unknown[/eluser]
Hello All,
I am new to codeigniter.I am trying to insert a varchar datatype value into the table. So its showing unknown column or feild name. Its not inserting the value into the table. I am using default codeigniter insert function like this
$this->db->insert('mytable', $data);
But it not enclosing the field of datatype varchar while inserting into the table.
Below is the table structure and code what I am using to insert.
CREATE TABLE IF NOT EXISTS `products` (
`products_id` varchar(128) NOT NULL,
`quantity` int(10) unsigned default NULL,
`merchant_id` int(10) unsigned NOT NULL,
`modified_date` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`products_id`,`merchant_id`),
KEY `FK_products_1` (`merchant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
$insertData = array( ‘products_id’=> $productId,
‘quantity’ => $qty,
‘merchant_id’ => 1
);
$this->db->insert(‘products’, $insertData);
Thanks in advance.