Support Forum

Invalid Database Query

AA Acreo Aeneas
Acreo Aeneas
Member

I keep getting a JQuery pop-up in the upper left of my forum that keeps saying “Invalid Database Query”.  My user account is the only one that sees this at this point.

About 6 days ago (Dec. 6th), I was using a WP plugin called “Plugins Garbage Collector” and deleted what I thought were unused tables by SP5.  However, immediately after deleting those tables (whose names I don’t even remember), all my users including myself starting getting “Invalid Database Query”.

Talking with my host, I had him restore some “missing” tables from a older database backup from before WP 3.3 RC1 and before SP5 install.  Once those tables were put back in, every other user on the site and forums stop receiving that error message.  However, I am still seeing it.  Promoting a test user to my priveliges does not show up the “Invalid Database Query” message.  I’m the only one who’s still seeing it.

The tables that were “restored” are these:

– notice

– options

– ratings

– settings

– meta

– tags

Secondly, the forum’s error log still shows these messages:

December 11, 20111:05 pm database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

1:05 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

1:05 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

1:05 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

1:05 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=3

December 11, 2011

1:05 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=3

December 11, 2011

1:02 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

1:02 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

1:00 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

1:00 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:57 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:56 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:56 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:56 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:55 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:55 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:55 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:55 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:55 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:55 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:55 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:55 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:54 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:54 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:52 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:51 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

December 11, 2011

12:51 pm

database file: /problem-with-post-edit-buttonome/grscgami/public_html/wp-content/sp-resources/forum-plugins/private-messaging/sp-pm-plugin.php

line: 304

function: sp_pm_do_user_class

error: Table ‘grscgami_cms.wp_sfadversaries’ doesn’t exist

SELECT adversary_id FROM wp_sfadversaries WHERE user_id=1

 

What can be done?  Do I have to roll back my entire site and lose any new content in order to fix this or is there some simpler method?

10 Answers

New Answer

MP Mr Papa
Mr Papa
Member

as the error says, you are missing the wp_adversaries table…  look in the pm plugin install file for the table structure so you can create it manually… or restore like the others..

YS Yellow Swordfish
Yellow Swordfish
Member

This is the same error with the ‘sfadversaries’ table missing?

DC D.Caron
D.Caron
Member

No idea…It seemed to work once I posted something in the forum first… then people were able to see it. No idea why it would say the forum didn’t exist until then.

DC D.Caron
D.Caron
Member

Here is an example: http://lawlscomic.com/forum/forum-issues/

YS Yellow Swordfish
Yellow Swordfish
Member

You can check in the forum admin > toolbox > error log to see if it is the same error as was reported above but I suspect it is not. Looks like I messed up on a bit of code that went into the last update that causes an invalid database error when a forum is displayed with no topics. So it is probably this. That has been corrected this morning in svn and will be in the next ‘nightly’ build as well as the next official update. Nuisance factor only – it is non-destructive.

DC D.Caron
D.Caron
Member

Im seeing tons of things like this: 

 

December 13, 2011

12:16 pm

php file: /simple-press/forum/content/sp-forum-view-class.php

line: 435

function: sp_forumview_query

Notice | Trying to get property of non-object

December 13, 2011

11:21 am

database file: /var/www/vhosts/lawlscomic.com/problem-with-post-edit-buttonttpdocs/lawlscomic.com/wp-content/plugins/simple-press/forum/content/sp-forum-view-class.php

line: 534

function: spdb_table

error: Unknown column ‘lawls_sftopics.post_count_held’ in ‘where clause’

SELECT * FROM lawls_sfforums WHERE lawls_sfforums.forum_id=10 AND lawls_sftopics.post_count_held > 0

DC D.Caron
D.Caron
Member

Also, good to know, looking forward to this forum. It’s REALLY nice. You guys did a great job. 

DC D.Caron
D.Caron
Member

So… Does this indicate to you any reason why that may be happening?

 

December 13, 2011

12:16 pm

php file: /simple-press/forum/content/sp-forum-view-class.php

line: 435

function: sp_forumview_query

Notice | Trying to get property of non-object

December 13, 2011

11:21 am

database file: /var/www/vhosts/lawlscomic.com/problem-with-post-edit-buttonttpdocs/lawlscomic.com/wp-content/plugins/simple-press/forum/content/sp-forum-view-class.php

line: 534

function: spdb_table

error: Unknown column ‘lawls_sftopics.post_count_held’ in ‘where clause’

 

SELECT * FROM lawls_sfforums WHERE lawls_sfforums.forum_id=10 AND lawls_sftopics.post_count_held > 0

YS Yellow Swordfish
Yellow Swordfish
Member

This is presumably being seen for non-admin users when the forum is empty – yes? It is fixed in the nightlies, in SVN and in the next auto-update