• 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

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



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
 

Slavik

XenForo moderator
Staff member
#2
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.
 

Slavik

XenForo moderator
Staff member
#7
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.
 

MattW

Well-known member
#8
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 ;
 

Chris D

XenForo developer
Staff member
#9
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
This is the SQL statement to re-create the table, but there will be no data in there
Ninja!!
 
#11
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
 

Chris D

XenForo developer
Staff member
#13
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)