Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Column averagerating does not exist
#1
Quote:<error>
<dateline>1219123972</dateline>
<script></script>
<line>0</line>
<type>20</type>
<friendly_type>MyBB SQL Error</friendly_type>
<message>SQL Error: 1054 - Unknown column 'averagerating' in 'order clause'
Query:
SELECT t.*, t.username AS threadusername, u.username
FROM mybb_threads t
LEFT JOIN mybb_users u ON (u.uid = t.uid)
WHERE t.fid='11' AND t.visible='1'
ORDER BY t.sticky DESC, averagerating desc , t.totalratings DESC
LIMIT 0, 20
</message>
</error>
The column averagerating does not exist. The query can be found in the file forumdisplay.php (line 643).
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#2
Which SQL Engine?
#3
A user reported this issue in the german community. I'll ask him about that.

But I think it doesn't matter because if you search for "averagerating" in the files mysql_db_tables.php, pgsql_db_tables.php and sqlite_db_tables.php you get no result. But in the file forumdisplay.php you can find this:
        case "rating":
		$t = "";
		$sortfield = "averagerating";
		$sortfield2 = ", t.totalratings DESC";
		break;
Edit: He's using MySQLi.
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#4
No, averagerating is simply a reference column created during the query.

$ratingadd = "(t.totalratings/t.numratings) AS averagerating, ";

Ask him to try this


Attached Files
.php   forumdisplay.php (Size: 29.47 KB / Downloads: 213)
#5
Doesn't work:
Quote:<error>
<dateline>1219297785</dateline>
<script></script>
<line>0</line>
<type>20</type>
<friendly_type>MyBB SQL Error</friendly_type>
<message>SQL Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc
LIMIT 0, 20' at line 5
Query:
SELECT t.*, t.username AS threadusername, u.username
FROM mybb_threads t
LEFT JOIN mybb_users u ON (u.uid = t.uid)
WHERE t.fid='24' AND (t.visible='1' OR t.visible='0')
ORDER BY t.sticky DESC, t. desc
LIMIT 0, 20
</message>
</error>
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#6
Does this work?


Attached Files
.php   forumdisplay.php (Size: 29.47 KB / Downloads: 246)
#7
The user still gets this errors.
Quote:<error>
<dateline>1219622893</dateline>
<script></script>
<line>0</line>
<type>20</type>
<friendly_type>MyBB SQL Error</friendly_type>
<message>SQL Error: 1054 - Unknown column 'averagerating' in 'order clause'
Query:
SELECT t.*, t.username AS threadusername, u.username
FROM mybb_threads t
LEFT JOIN mybb_users u ON (u.uid = t.uid)
WHERE t.fid='18' AND t.visible='1'
ORDER BY t.sticky DESC, averagerating asc , t.totalratings DESC
LIMIT 20, 20
</message>
</error>
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#8
Alright, I need more information. Tell me how to do this. Give an example or something.
#9
One way to reproduce it is to disable thread ratings in the forum, then try to sort by rating. I could have sworn I reported that as a bug in one of the 1.2 betas... hmm :/
#10
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.


Forum Jump:


Users browsing this thread: 1 Guest(s)