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

XF 1.5 mysql prepare error

dehness

Active member
#1
Hi, after uninstalling this add-on (it had been disabled for a long time, just not uninstalled), I get the following error whenever someone tries to post/edit a post.

Unfortunately the add-on author is long gone, and I don't have the original .xml to simply re-install it.

I'm guessing I need to modify the database tables that were changed for the add-on?

Code:
The following error occurred:
Mysqli prepare error: Unknown column 'edit_count' in 'field list'

    Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
    Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
    Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
    Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 574
    Zend_Db_Adapter_Abstract->insert() in XenForo/DataWriter.php at line 1624
    XenForo_DataWriter->_insert() in XenForo/DataWriter.php at line 1613
    XenForo_DataWriter->_save() in XenForo/DataWriter.php at line 1405
    XenForo_DataWriter->save() in XenForo/ControllerPublic/Thread.php at line 557
    XenForo_ControllerPublic_Thread->actionAddReply() in XenForo/FrontController.php at line 347
    XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
    XenForo_FrontController->run() in /var/www/clients/client1/web1/web/index.php at line 13
 

Brogan

XenForo moderator
Staff member
#2
I think I know what the problem is but can you run this query in PMA:
Code:
show create table `xf_post`
Then select full texts and post the output here.
 

dehness

Active member
#3
I think I know what the problem is but can you run this query in PMA:
Code:
show create table `xf_post`
Then select full texts and post the output here.
Hi Brogan,

We don't actually use PMA.

This is from the xf_post table.

Code:
+---------------------------+---------------------------------------+------+-----+---------+----------------+
| Field                     | Type                                  | Null | Key | Default | Extra          |
+---------------------------+---------------------------------------+------+-----+---------+----------------+
| post_id                   | int(10) unsigned                      | NO   | PRI | NULL    | auto_increment |
| thread_id                 | int(10) unsigned                      | NO   | MUL | NULL    |                |
| user_id                   | int(10) unsigned                      | NO   | MUL | NULL    |                |
| username                  | varchar(50)                           | NO   |     | NULL    |                |
| post_date                 | int(10) unsigned                      | NO   | MUL | NULL    |                |
| message                   | mediumtext                            | NO   |     | NULL    |                |
| ip_id                     | int(10) unsigned                      | NO   |     | 0       |                |
| message_state             | enum('visible','moderated','deleted') | NO   |     | visible |                |
| attach_count              | smallint(5) unsigned                  | NO   |     | 0       |                |
| position                  | int(10) unsigned                      | NO   |     | NULL    |                |
| likes                     | int(10) unsigned                      | NO   |     | 0       |                |
| like_users                | blob                                  | NO   |     | NULL    |                |
| warning_id                | int(10) unsigned                      | NO   |     | 0       |                |
| warning_message           | varchar(255)                          | NO   |     |         |                |
| last_edit_username        | varchar(50)                           | NO   |     |         |                |
| last_edit_user_id         | int(10) unsigned                      | NO   |     | 0       |                |
| last_edit_date            | int(10) unsigned                      | NO   |     | 0       |                |
| reputations               | int(11)                               | YES  |     | 0       |                |
| br_reputations_count      | int(10) unsigned                      | NO   |     | 0       |                |
| br_first_reputation_date  | int(10) unsigned                      | NO   |     | 0       |                |
| br_last_reputations_date  | int(10) unsigned                      | NO   |     | 0       |                |
| br_lastest_reputation_ids | varbinary(200)                        | YES  |     | NULL    |                |
+---------------------------+---------------------------------------+------+-----+---------+----------------+
22 rows in set (0.45 sec)

mysql>
 

Brogan

XenForo moderator
Staff member
#4
Run this query to add the missing column:
Code:
ALTER TABLE xf_post
ADD edit_count INT(10) unsigned NOT NULL DEFAULT 0
AFTER last_edit_user_id
You have one other extra column (other than the br_ stuff), which is last_edit_username.

It could be from another add-on though so it's best to leave it.
 

dehness

Active member
#5
Thanks @Brogan! Looks like posts are working again now.

Although it looks like I added it at the bottom of the table somehow (see below), does that matter?
Code:
+---------------------------+---------------------------------------+------+-----+---------+----------------+
| Field                     | Type                                  | Null | Key | Default | Extra          |
+---------------------------+---------------------------------------+------+-----+---------+----------------+
| post_id                   | int(10) unsigned                      | NO   | PRI | NULL    | auto_increment |
| thread_id                 | int(10) unsigned                      | NO   | MUL | NULL    |                |
| user_id                   | int(10) unsigned                      | NO   | MUL | NULL    |                |
| username                  | varchar(50)                           | NO   |     | NULL    |                |
| post_date                 | int(10) unsigned                      | NO   | MUL | NULL    |                |
| message                   | mediumtext                            | NO   |     | NULL    |                |
| ip_id                     | int(10) unsigned                      | NO   |     | 0       |                |
| message_state             | enum('visible','moderated','deleted') | NO   |     | visible |                |
| attach_count              | smallint(5) unsigned                  | NO   |     | 0       |                |
| position                  | int(10) unsigned                      | NO   |     | NULL    |                |
| likes                     | int(10) unsigned                      | NO   |     | 0       |                |
| like_users                | blob                                  | NO   |     | NULL    |                |
| warning_id                | int(10) unsigned                      | NO   |     | 0       |                |
| warning_message           | varchar(255)                          | NO   |     |         |                |
| last_edit_username        | varchar(50)                           | NO   |     |         |                |
| last_edit_user_id         | int(10) unsigned                      | NO   |     | 0       |                |
| last_edit_date            | int(10) unsigned                      | NO   |     | 0       |                |
| reputations               | int(11)                               | YES  |     | 0       |                |
| br_reputations_count      | int(10) unsigned                      | NO   |     | 0       |                |
| br_first_reputation_date  | int(10) unsigned                      | NO   |     | 0       |                |
| br_last_reputations_date  | int(10) unsigned                      | NO   |     | 0       |                |
| br_lastest_reputation_ids | varbinary(200)                        | YES  |     | NULL    |                |
| edit_count                | int(10) unsigned                      | NO   |     | 0       |                |
+---------------------------+---------------------------------------+------+-----+---------+----------------+
23 rows in set (0.00 sec)