1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mysqli prepare error: Table 'xenforo.xf_ip' doesn't exist

Discussion in 'Troubleshooting and Problems' started by thekillerofevil, Jan 5, 2013.

  1. Whenever a user tries to post on the forums, they get this error:

    [​IMG]

    Is there any way I can fix this? I don't know what has caused this, but it happened on a server reboot. Last time the server rebooted it caused an error in the temporary section of the database, but this didn't happen. Now I just don't know whats wrong. Any help would be appreciated as these forums are vital to me.

    The installation is located at http://skyblock.us
     
  2. Slavik

    Slavik XenForo Moderator Staff Member

    Just wondering why the copyright link on your forum was removed?

    As for the error, you've lost your xf_ip table somehow. Was the server shut down correctly?
     
  3. I'm not sure about the actual installation, my buddy installed it for me. I didn't do anything, just typed reboot into the command line. I wasn't thinking about the forums having an error.
     
  4. I also cannot log into the admin panel.
     
  5. MattW

    MattW Well-Known Member

    Either way, your table is missing from the database. Do you have a recent backup of your database?
     
  6. No, sadly I do not :/
     
  7. Slavik

    Slavik XenForo Moderator Staff Member

    Sounds like you caused some data loss with your reboot.

    Try running a MySQL repair on the database. Failing that you'll either need to rebuild any missing tables you have, or restore from a backup.
     
    Jake Bunce likes this.
  8. MattW

    MattW Well-Known Member

    This is the SQL statement to re-create the table, but there will be no data in there

    Code:
    CREATE TABLE IF NOT EXISTS `xf_ip` (
      `ip_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `user_id` int(10) unsigned NOT NULL,
      `content_type` varbinary(25) NOT NULL,
      `content_id` int(10) unsigned NOT NULL,
      `action` varbinary(25) NOT NULL DEFAULT '',
      `ip` int(10) unsigned NOT NULL,
      `log_date` int(10) unsigned NOT NULL,
      PRIMARY KEY (`ip_id`),
      KEY `user_id_log_date` (`user_id`,`log_date`),
      KEY `ip_log_date` (`ip`,`log_date`),
      KEY `content_type_content_id` (`content_type`,`content_id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;
     
    Jake Bunce and Chris D like this.
  9. Chris D

    Chris D XenForo Developer Staff Member

    This should be the MySQL query to rebuild that table:

    Code:
     CREATE TABLE xf_ip (
    ip_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    user_id INT UNSIGNED NOT NULL,
    content_type varbinary(25) NOT NULL,
    content_id INT UNSIGNED NOT NULL,
    action varbinary(25) NOT NULL DEFAULT '',
    ip INT UNSIGNED NOT NULL,
    log_date INT UNSIGNED NOT NULL,
    PRIMARY KEY (ip_id),
    KEY user_id_log_date (user_id, log_date),
    KEY ip_log_date (ip, log_date),
    KEY content_type_content_id (content_type, content_id)
    ) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci
    Ninja!!
     
    Jake Bunce and MattW like this.
  10. Slavik

    Slavik XenForo Moderator Staff Member

    And then re-add the copyright back in ;)
     
    Chris D and MattW like this.
  11. TheComputerGuy

    TheComputerGuy Active Member

    So I've done the query Chris suggested...and now I get this
    Mysqli statement execute error : Incorrect integer value: 'Kn?' for column 'ip' at row 1

    kn being what I tested with
     
  12. Chris D

    Chris D XenForo Developer Staff Member

    What version of XF? 1.3.x?

    In XF 1.3 that table looks quite different.
     
  13. Chris D

    Chris D XenForo Developer Staff Member

    For XF 1.3:
    Code:
    DROP TABLE IF EXISTS `xf_ip`;
    CREATE TABLE IF NOT EXISTS `xf_ip` (
      `ip_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `user_id` int(10) unsigned NOT NULL,
      `content_type` varbinary(25) NOT NULL,
      `content_id` int(10) unsigned NOT NULL,
      `action` varbinary(25) NOT NULL DEFAULT '',
      `ip` varbinary(16) NOT NULL,
      `log_date` int(10) unsigned NOT NULL,
      PRIMARY KEY (`ip_id`),
      KEY `user_id_log_date` (`user_id`,`log_date`),
      KEY `ip_log_date` (`ip`,`log_date`),
      KEY `content_type_content_id` (`content_type`,`content_id`),
      KEY `log_date` (`log_date`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    (Note the first line drops the existing table. The following lines recreate it)
     

Share This Page