Все привет!
Получаю ошибку:
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 'WHERE id = '5'' at line 15 UPDATE transactions SET type = '4', sum = '1000.00', fee = '50.00', amount = '1200.00', status = '4', sender = 'admin', receiver = 'testuser1', user_comment = '', admin_comment = '', check_notify = '1', notification = '', WHERE id = '5'
Код запроса:
function edit_transaction($data = array())
{
if ($data)
{
$sql = "
UPDATE {$this->_db}
SET
type = " . $this->db->escape($data['type']) . ",
sum = " . $this->db->escape($data['sum']) . ",
fee = " . $this->db->escape($data['fee']) . ",
amount = " . $this->db->escape($data['amount']) . ",
status = " . $this->db->escape($data['status']) . ",
sender = " . $this->db->escape($data['sender']) . ",
receiver = " . $this->db->escape($data['receiver']) . ",
user_comment = " . $this->db->escape($data['user_comment']) . ",
admin_comment = " . $this->db->escape($data['admin_comment']) . ",
check_notify = " . $this->db->escape($data['check_notify']) . ",
notification = " . $this->db->escape($data['notification']) . ",
WHERE id = " . $this->db->escape($data['id']) . "
";
$this->db->query($sql);
if ($this->db->affected_rows())
{
return TRUE;
}
}
return FALSE;
}
Вопрос:
Почему я получаю ошибку? Проект на CI.
Благодарен за любую помощь.