my website was working fine since i uploaded it a year ago. but a few days ago i suddenly get the error message 1231 in my 000webhost.com website. the error comes either right when i open my website or after i navigate through it. can anybody help? has anybody experience with this error? what could be the cause? and how to solve it?
i thought i can fix it by updating my codeigniter 3.1.7 to the latest version 3.1.10., but it didnt help. i changed the php version from 7.2 to 7.0 and later to 5.6, also made no difference.
libraries/Session/drivers/Session_database_driver.php and mysql_driver.php
/**
* Validate ID
*
* Checks whether a session ID record exists server-side,
* to enforce session.use_strict_mode.
*
* @param string $id
* @return bool
*/
public function validateSessionId($id)
{
// Prevent previous QB calls from messing with our queries
$this->_db->reset_query();
$this->_db->select('1')->from($this->_config['save_path'])->where('id', $id);
empty($this->_config['match_ip']) OR $this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']);
$result = $this->_db->get();
empty($result) OR $result = $result->row();
return ! empty($result);
}
/**
* Database connection
*
* @param bool $persistent
* @return object
*/
public function db_connect($persistent = FALSE)
{
// Do we have a socket path?
if ($this->hostname[0] === '/')
{
$hostname = NULL;
$port = NULL;
$socket = $this->hostname;
}
else
{
$hostname = ($persistent === TRUE)
? 'p:'.$this->hostname : $this->hostname;
$port = empty($this->port) ? NULL : $this->port;
$socket = NULL;
}
$client_flags = ($this->compress === TRUE) ? MYSQLI_CLIENT_COMPRESS : 0;
$this->_mysqli = mysqli_init();
$this->_mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 10);
if (isset($this->stricton))
{
if ($this->stricton)
{
$this->_mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")');
}
else
{
$this->_mysqli->options(MYSQLI_INIT_COMMAND,
'SET SESSION sql_mode =
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
@@sql_mode,
"STRICT_ALL_TABLES,", ""),
",STRICT_ALL_TABLES", ""),
"STRICT_ALL_TABLES", ""),
"STRICT_TRANS_TABLES,", ""),
",STRICT_TRANS_TABLES", ""),
"STRICT_TRANS_TABLES", "")'
);
}
}
A Database Error Occurred Error Number: 1231
Variable ‘sql_mode’ can’t be set to the value of ‘REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE( @@sql_mode’
SELECT 1 FROM ci_sessions WHERE id = ‘9mk3avf3kaocstm4rrcappec902q2msi’ AND ip_address = ‘x.x.x.x’
Filename: libraries/Session/drivers/Session_database_driver.php
Line Number: 363