I get an error in my Codeigniter Model that inserts a single row into a MySQL table. The following is a description of the error.
A Database Error Occurred
Error Number: 1054
Unknown column 'value2' in 'field list'
INSERT INTO `tablename` (`column1`, `column2`) VALUES (value1, value2)
Filename: path\to\DB_driver.php
Line Number: 330
Both columns are varchar columns. Does anyone know about this error?
The error message is inserted as a verbatim copy. My controller code is as follows:
$deviceID=$xmlString->deviceID;
$appType=$xmlString->appType;
$data = array( 'deviceIdentifier' => $deviceID, 'installType'=>$appType );
$this->device_model->insert_new_device($data);
My model code is as follows
class device_model extends CI_Model {
function insert_new_device($lData) {
$this->db->insert('devices', $lData);
return $this->db->insert_id();
}
}
source
share