错误编号:1064 CodeIgniter

Error Number: 1064 CodeIgniter

错误编号:1064

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'png WHERE Id = '5'' at line 1

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

文件名:C:\xampp1\htdocs\ams\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');

}

试试这个方法

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

}

试试这个

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

尝试从 set 方法中删除 False

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