Support Forum

error: Unknown column 'hide_stats' in 'where clause'

JE Jeferson
Jeferson
Member

Hello,

 

Can someone help me out with this error: 

May 25, 2016 11:09 am | spaErrError | 2 | database


file: /var/www/html/BLA/wp-content/plugins/simple-press/forum/database/sp-db-statistics.php
line: 278
function: select
error: Unknown column ‘hide_stats’ in ‘where clause’

SELECT SQL_CALC_FOUND_ROWS wpBLA_sfmembers.user_id, display_name, posts FROM wpBLA_sfmembers JOIN wpBLA_sfmemberships ON wpVGU_sfmembers.user_id = wpBLA_sfmemberships.user_id JOIN wpVGU_sfusergroups ON wpBLA_sfmemberships.usergroup_id = wpBLA_sfusergroups.usergroup_id WHERE hide_stats = 0 AND admin=0 AND moderator=0 AND posts > -1 GROUP BY wpBLA_sfmembers.user_id ORDER BY hide_stats ASC, posts DESC LIMIT 0, 5

 

I have restored an older version of the database when everything was still working but then I get the same error. 

I also did the network upgrade (of the DB) still no succes. 

5 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Odd. This column was added to the table in the 5.6.6 update. If it had failed I would have expected the upgrade to error and clearly it dd not or you would have reported that (I assume anyway).

It was the only db change in the 5.6.6 update, And tis is the only report of a failure…

The only thing I can think of is to run a query against your database to create the column. Is that going to be possible? Or manually create it of course. I can give you a query or details.

But, of course, it is worrying. Could it be that the user who ran the update had no create column privilege with your mySQL server?

JE Jeferson
Jeferson
Member

Hello,

 

Well the user had create roles in mysql. 
But we had some issues with updating so maybe it went wrong. 

Can you give me the SQL query’s that where supposed to happen at update? 
That way I can execute them now. 

YS Yellow Swordfish
Yellow Swordfish
Member

I was meaning actual create columns, tables etc., on the mysql server itself. They probably do as they will be using the same db login credentials as the main owner/adminintartor.

Can you describe the issues you had?

Here is the sql query.

ALTER TABLE xxx_sfusergroups ADD (hide_stats tinyint(1) unsigned NOT NULL default '0');

You need to swap the ‘xxx’ for your WP table prefix of course.

I am sorry to hear you had the probpem…

JE Jeferson
Jeferson
Member

Thanks, this seems to have fix the issue. 

Yea but regarding the update you helped me out as well. It was due to an older version of PHP on our systems. 

So again, thank you very much!!!! 

YS Yellow Swordfish
Yellow Swordfish
Member

My memory is not what it used to be 🙂