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 运筹学中在线排序的时间在线排序的在线LPT算法
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧