Variable 'sql_mode' can't be set to the value of 'REPLACE

19,460

Solution 1

Open file config/database.php and change value's variable stricton to be 'TRUE'

'stricton' => TRUE,

Solution 2

No idea why this throws. But you can temporarily bypass it by setting sql_mode to null

$this->db->query("SET sql_mode = '' ");
//rest of your DB codes

Solution 3

before you import sql file to database(mysql)

change line

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

to be

SET SQL_MODE = "";
Share:
19,460
TarangP
Author by

TarangP

Available for solving your PHP / Django Problems. Mail @ [email protected].

Updated on July 28, 2022

Comments

  • TarangP
    TarangP over 1 year

    I don't know why but suddenly I getting the following error.

    Till now it is working fine but today it will produce the following error enter image description here

    it is working fine when I test to the local server but when I uploaded to 000webhost server it will produce an error

    Variable 'sql_mode' can't be set to the value of 'REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE( @@sql_mode' SELECT vValue FROM configurations WHERE eStatus = 'Active' AND vName = > 'PAGE_DATA_LIMIT' ORDER BY iSettingId DESC

    At Filename: core/MY_Model.php all code is working fine there is no error on Line Number: 94 which is displayed

  • TarangP
    TarangP over 4 years
    Can you please explain what it changes & what is the usage. Thanks.
  • Dariswan Janweri P.
    Dariswan Janweri P. over 4 years
    so, TRUE/FALSE (boolean) - Whether to force “Strict Mode” connections, good for ensuring strict SQL while developing an application. sorry i didnt give any information, i just read documentation's code igniter : codeigniter.com/user_guide/database/configuration.html