MyBB Community Forums

Full Version: Lite (Archive) Mode - SQL ERROR related to 'status' column and mysql_db_inserts.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
MyBB version: 1.8 Beta 2 (fresh install on localhost)
Apache: 2.4.9 (Win32)
PHP: 5.5.14
MySQL: 5.6.19
Browser: Firefox 30.0

Immediately after (default) installation, open:
yourwebsite.com/archive/index.php?forum-1.html

The result is:
SQL Error: 1054 - Unknown column 'status' in 'where clause'
Query: SELECT COUNT(fid) AS subforums FROM mybb_forums WHERE pid='1' AND status='1'

[Image: error_archive.jpg]

Please check MYBB_ROOT/archive/index.php (line 299):
		$query = $db->simple_select("forums", "COUNT(fid) AS subforums", "pid='{$id}' AND status='1'");

// L.E.: Without status='1' in 'where' conditions (line 299), it works fine:
		$query = $db->simple_select("forums", "COUNT(fid) AS subforums", "pid='{$id}'");

The reason: 'status' column does not exist in the "_forums" table.
Check MYBB_ROOT/install/resources/mysql_db_inserts.php (line 35) - for MyBB 1.8 BETA 2
$inserts[] = "INSERT INTO mybb_forums (fid, name, description, linkto, type, pid, parentlist, disporder, active, open, threads, posts, lastpost, lastposter, lastposttid, allowhtml, allowmycode, allowsmilies, allowimgcode, allowvideocode, allowpicons, allowtratings, usepostcounts, usethreadcounts, password, showinjump, modposts, modthreads, modattachments, style, overridestyle, rulestype, rulestitle, rules) VALUES (1, 'My Category', '', '', 'c', 0, '1', 1, 1, 1, 0, 0, 0, '0', 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, '', 1, 0, 0, 0, 0, 0, 0, '', '');";
$inserts[] = "INSERT INTO mybb_forums (fid, name, description, linkto, type, pid, parentlist, disporder, active, open, threads, posts, lastpost, lastposter, lastposttid, allowhtml, allowmycode, allowsmilies, allowimgcode, allowvideocode, allowpicons, allowtratings, usepostcounts, usethreadcounts, password, showinjump, modposts, modthreads, modattachments, style, overridestyle, rulestype, rulestitle, rules) VALUES (2, 'My Forum', '', '', 'f', 1, '1,2', 1, 1, 1, 0, 0, 0, '0', 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, '', 1, 0, 0, 0, 0, 0, 0, '', '');";

In MyBB 1.6.14, in the same file (MYBB_ROOT/install/resources/mysql_db_inserts.php), 'status' column is present after "allowtratings,":
$inserts[] = "INSERT INTO mybb_forums (fid, name, description, linkto, type, pid, parentlist, disporder, active, open, threads, posts, lastpost, lastposter, lastposttid, allowhtml, allowmycode, allowsmilies, allowimgcode, allowvideocode, allowpicons, allowtratings, status, usepostcounts, password, showinjump, modposts, modthreads, modattachments, style, overridestyle, rulestype, rulestitle, rules) VALUES (1, 'My Category', '', '', 'c', 0, '1', 1, 1, 1, 0, 0, 0, '0', 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, '', 1, 0, 0, 0, 0, 0, 0, '', '');";
$inserts[] = "INSERT INTO mybb_forums (fid, name, description, linkto, type, pid, parentlist, disporder, active, open, threads, posts, lastpost, lastposter, lastposttid, allowhtml, allowmycode, allowsmilies, allowimgcode, allowvideocode, allowpicons, allowtratings, status, usepostcounts, password, showinjump, modposts, modthreads, modattachments, style, overridestyle, rulestype, rulestitle, rules) VALUES (2, 'My Forum', '', '', 'f', 1, '1,2', 1, 1, 1, 0, 0, 0, '0', 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, '', 1, 0, 0, 0, 0, 0, 0, '', '');";

So, the question is: it is needed to keep "status" column in "_forums" table or not?

If the answer is YES, then should be included in MYBB_ROOT/install/resources/mysql_db_inserts.php file, otherwise, as i mentioned before,
AND status='1'
should be removed from 'where' conditions in MYBB_ROOT/archive/index.php file (line 299).
The status column was removed because it was useless. Obviously I need to remove that bit from archive/index.php.
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/977

Thanks for contributing to MyBB!

Regards,
The MyBB Group