当我要更新数据库时,我收到这样的错误:

时间:2015-01-06 10:50:51

标签: mysql codeigniter

我收到此错误:

A Database Error Occurred
Error Number: 0  
UPDATE `announcement_detail` SET `announcement_title` = 'test', `announcement_desc` = 'test announcement\r\ntest announcement\r\ntest announcement\r\ntest announcement\r\ntest announcement\r\ntest announcement ', `announcement_date` = '2015-01-05' WHERE `announcement_id` = 101 
Filename: C:\wamp\www\nid\system\database\DB_driver.php 
Line Number: 330

2 个答案:

答案 0 :(得分:0)

你是否正在逃避你的' \' ?见http://dev.mysql.com/doc/refman/4.1/en/string-literals.html

答案 1 :(得分:0)

尝试此活动记录:

$data = array(
         "announcement_title" => "test1",
         "announcement_desc"  => "some description",
         "announcement_date"  => "2015-01-05"

);

$this->db->update("announcement_detail",$data);
$this->db->where("announcement_id",101);