Доброго дня!
Работаю с CI. Выполняю запрос:
function edit_template($data = array())
{
if ($data)
{
$sql = "
UPDATE {$this->_db}
SET
title = " . $this->db->escape($data['title']) . ",
check = " . $this->db->escape($data['check']) . ",
message = " . $this->db->escape($data['message']) . "
WHERE id = " . $this->db->escape($data['id']) . "
";
$this->db->query($sql);
if ($this->db->affected_rows())
{
return TRUE;
}
}
return FALSE;
}
Получаю ошибку:
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'check = '1', message = '23', WHERE id = '1'' at line 4
UPDATE sms_template SET title = 'Пополнение счета', check = '1', message = '23', WHERE id = '1'
Что я делаю не так?
Без строки check = " . $this->db->escape($data['check']) . ",
все работает без ошибок.
Благодарен за любую помощь!
check
какой тип в таблице имеет и в вашем php?