doushang8846 2019-08-14 16:39
浏览 162
已采纳

000webhost网站上的数据库错误号1231

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

  • 写回答

1条回答 默认 最新

  • doucong1853 2019-08-19 12:58
    关注

    open file applications/config/database.php change variable stricton to TRUE

    'stricton' => TRUE,
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化