Search code examples
phpdatabasecodeignitercodeigniter-3mysql-error-1064

Error Number: 1064 CodeIgniter


Error Number: 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'

Filename: C:\xampp1\htdocs\ams\system\database\DB_driver.php

Line Number: 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');

}

Solution

  • try this way

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