title: Database Error No. 1231 on 000webhost website
body: <p>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?</p>
  
  <p>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. </p>
  
  <p>libraries/Session/drivers/Session_database_driver.php and mysql_driver.php</p>
  
  <pre><code>    /**
       * 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-&gt;_db-&gt;reset_query();
  
          $this-&gt;_db-&gt;select('1')-&gt;from($this-&gt;_config['save_path'])-&gt;where('id', $id);
          empty($this-&gt;_config['match_ip']) OR $this-&gt;_db-&gt;where('ip_address', $_SERVER['REMOTE_ADDR']);
          $result = $this-&gt;_db-&gt;get();
          empty($result) OR $result = $result-&gt;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-&gt;hostname[0] === '/')
      {
          $hostname = NULL;
          $port = NULL;
          $socket = $this-&gt;hostname;
      }
      else
      {
          $hostname = ($persistent === TRUE)
              ? 'p:'.$this-&gt;hostname : $this-&gt;hostname;
          $port = empty($this-&gt;port) ? NULL : $this-&gt;port;
          $socket = NULL;
      }
  
      $client_flags = ($this-&gt;compress === TRUE) ? MYSQLI_CLIENT_COMPRESS : 0;
      $this-&gt;_mysqli = mysqli_init();
  
      $this-&gt;_mysqli-&gt;options(MYSQLI_OPT_CONNECT_TIMEOUT, 10);
  
      if (isset($this-&gt;stricton))
      {
          if ($this-&gt;stricton)
          {
              $this-&gt;_mysqli-&gt;options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")');
          }
          else
          {
              $this-&gt;_mysqli-&gt;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", "")'
              );
          }
      }
  </code></pre>
  
  <p>A Database Error Occurred
  Error Number: 1231</p>
  
  <p>Variable ‘sql_mode’ can’t be set to the value of ‘REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE( @@sql_mode’</p>
  
  <p>SELECT 1 FROM ci_sessions WHERE id = ‘9mk3avf3kaocstm4rrcappec902q2msi’ AND ip_address = ‘x.x.x.x’</p>
  
  <p>Filename: libraries/Session/drivers/Session_database_driver.php</p>
  
  <p>Line Number: 363</p>