错误号:1064 CodeIgniter

时间:2017-11-04 04:55:04

标签: php database codeigniter codeigniter-3 mysql-error-1064

错误号码:1064

  

您的SQL语法有错误;检查手册   对应于您的MariaDB服务器版本,以获得正确的语法   在&{39}附近Id =' 5''在第1行

UPDATE `photos` SET `PhotoName` = screencapture-localhost-quickstart_shopy-1508597579405.png WHERE `Id` = '5'

文件名:C:\ xampp1 \ htdocs \ _ms \ system \ database \ DB_driver.php

行号:331

Model_File

public function EditPhoto1($data,$Id)
{
    $this->db->where('Id', $Id);
    $this->db->set('PhotoName', $data['PhotoName'], FALSE);
    return $this->db->update('photos');

}

3 个答案:

答案 0 :(得分:1)

试试这种方式

public function EditPhoto1($data,$Id)
{
    $photoName = $data['PhotoName'];
    $this->db->where('Id', $Id);
    $this->db->set('PhotoName',$photoName);
    return $this->db->update('photos');

}

答案 1 :(得分:1)

试试这个

public function EditPhoto1($data,$Id)
{
    $this->db->where('Id', $Id);
    $d = ['PhotoName' => $data['PhotoName']];
    $this->db->update('photos', $d); 
}

答案 2 :(得分:0)

尝试从set方法中删除 False

public function EditPhoto1($data,$Id)
{
    $this->db->where('Id', $Id);
    $this->db->set('PhotoName', (strval)$data['PhotoName']);
    return $this->db->update('photos');
}