I have this problem whenever I insert my integer value to my database it looks like this
<h1>A Database Error Occurred</h1>
<p>Error Number: 1366</p><p>Incorrect integer value: '
11' for column 'code' at row 1</p><p>INSERT INTO `company`(`code`, `Name`)
VALUES('
11', 'John')
my code is in a span and my name is an input type. is there a way to remove the in the values?
ADDITIONAL CODE
function insert_new_name()
{
$code = $this->input->get('code');
$name = $this->input->get('name');
$sSQL = "SELECT * FROM company WHERE code = ? or Name = ? AND `show` = 1" ;
$result = $this->db->query($sSQL, array($code, $name));
if($result->num_rows() != 0)
{
return json_encode('error');
}
else
{
$sSQL = "INSERT INTO `company`(`code`, `Name`)
VALUES(?, ?) ";
$result = $this->db->query($sSQL, array($code, $name));
$id = $this->db->insert_id();
$sSQLdisplay = "SELECT * FROM Name where id = '$id' ";
$resultdisplay = $this->db->query($sSQLdisplay);
$data = array();
$row = $resultdisplay->row();
$data[] = Array($row->id);
$data[] = Array($row->code);
$data[] = Array($row->Name);
$data[] = Array('');
$data[] = Array('');
$resultdisplay->free_result();
return json_encode($data);
}
}