-
Bug
-
Resolution: Fixed
-
3.0.RC7
-
None
-
PHP Environment:
Database:
-----------------
SQL ERROR [ mysql4 ]
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 \'AND topic_moved_id = 0\n AND topic_last_post_time < \n AND topic_approved = \' at line 4 [1064]
SQL
SELECT topic_id, forum_id\n FROM phpbb_topics\n WHERE forum_id = \n AND topic_moved_id = 0\n AND topic_last_post_time < \n AND topic_approved = 1\n ORDER BY topic_last_post_time DESC\n LIMIT 1
BACKTRACE
FILE: includes/db/mysql.php
LINE: 158
CALL: dbal->sql_error()
FILE: includes/db/mysql.php
LINE: 205
CALL: dbal_mysql->sql_query()
FILE: includes/db/dbal.php
LINE: 153
CALL: dbal_mysql->_sql_query_limit()
FILE: viewtopic.php
LINE: 134
CALL: dbal->sql_query_limit()
------------------------------------------
The call error happens when someone calls view next or prev when $row['topic_last_post_time'] is empty...
I added in front of that sql the following code that fixes it
if (!$row['topic_last_post_time'])
{ $user->setup('viewtopic'); trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS'); }