include "includes/common.inc"; include "includes/section.inc"; $theme->header(); $terms = check_input($terms); $output .= "
\n"; $output .= " | \n"; $output .= "||
\n";
// Compose and perform query:
$query = "SELECT s.id, s.subject, u.userid, s.timestamp, COUNT(c.cid) AS comments FROM stories s LEFT JOIN users u ON s.author = u.id LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 ";
$query .= ($author) ? "AND u.userid = '$author' " : "";
$query .= ($terms) ? "AND (s.subject LIKE '%$terms%' OR s.abstract LIKE '%$terms%' OR s.updates LIKE '%$terms%') " : "";
$query .= ($section) ? "AND s.section = '$section' GROUP BY s.id " : "GROUP BY s.id ";
$query .= ($order == 1) ? "ORDER BY s.timestamp ASC" : "ORDER BY s.timestamp DESC";
$result = db_query($query);
// Display search results:
$output .= " \n"; while ($entry = db_fetch_object($result)) { $num++; $output .= " $num) id\">". check_output($entry->subject) ." (". format_plural($entry->comments, "comment", comments) .") Your search did not match any articles in our database:
$num results matched your search query. \n"; $output .= " | \n";
$output .= "