I've tried to give my "get_threads" variable some additional content, based on the actual case. But it doesn't work as expected, the query isn't executing at all. It looks like there are some blanks that are missing in the "final" variable. But when i add them to the value, the output completely dissapears.
The output query is:
SELECT id, main_forum_id, icon_id, title, description, author_id, closed, views, posts, date_created, last_post_author_id, last_replyTime FROM forum_thread WHERE main_forum_id= ('1') ORDER BY views ASC LIMIT 0, 20
And that's the code:
$get_threads = "SELECT id, main_forum_id, icon_id, title, description, author_id, closed, views, posts, date_created, last_post_author_id, last_replyTime FROM forum_thread WHERE main_forum_id= ('" . $actualBoard . "')";
if (isset($_GET[ 'sortField' ])) {
switch ($_GET[ 'sortField' ]) {
case topic:
$get_threads .= " ORDER BY title ASC ";
break;
case rating:
$get_threads .= " ORDER BY rating ASC ";
break;
case replies:
$get_threads .= " ORDER BY replies ASC ";
break;
case views:
$get_threads .= " ORDER BY views ASC ";
break;
case lastReply:
$get_threads .= " ORDER BY last_replyTime DESC ";
break;
}
} else {
$lastReplyClass = 'columnLastPost active';
$get_threads .= " ORDER BY last_replyTime ASC ";
}
$get_threads .= " LIMIT $start, $perPage";
SOLUTION:
Okay, i'm such an idiot.. Had a format function for the time and deleted it. That caused the error:
Fatal error: Call to undefined function formatDateString()
caseparameters. example:case 'topic':(if topic not defined as constant)defaultcase inswitch...