mirror of
https://git.code.sf.net/p/quake/website
synced 2024-11-27 22:42:57 +00:00
add preliminary news searching... hopefully the rest will make it in later tonight
This commit is contained in:
parent
e5d3a3a989
commit
fef584f5c7
1 changed files with 31 additions and 0 deletions
|
@ -25,4 +25,35 @@
|
|||
$today['year']--;
|
||||
}
|
||||
}
|
||||
function searchNews ($string)
|
||||
{
|
||||
need ('date sql');
|
||||
echo '<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0"> <TR vAlign="top"> <TD colSpan="2">';
|
||||
tableBoxHeader( 'black', tableHeadColor );
|
||||
tableTitle( $pageName, 1, tableHeadColor );
|
||||
|
||||
$search = "\'%$string\%'";
|
||||
$conn = @mysql_pconnect (sqlHost, sqlUser, sqlPass);
|
||||
if ($conn) {
|
||||
$query = 'SELECT n_date, n_user, n_news FROM news_main WHERE '.
|
||||
'n_news LIKE ' . $search . ' ORDER BY n_date DESC';
|
||||
$result = @mysql_db_query (sqlDB, $query, $conn);
|
||||
if ($result) {
|
||||
$numRows = @mysql_num_rows ($result);
|
||||
if ($numRows) {
|
||||
for ($i = 0 ; $i < $numRows ; $i++) {
|
||||
list ($n_date, $n_user, $n_news) = mysql_fetch_row ($result);
|
||||
newsItem (dateFromSQLDateTime ($n_date), $n_user, StripSlashes($n_news));
|
||||
}
|
||||
} else {
|
||||
echo '<P>No news found matching "' . $string . '"\n';
|
||||
}
|
||||
} else {
|
||||
echo '<P>No news found matching "' . $string . '"\n';
|
||||
}
|
||||
mysql_close ($conn);
|
||||
} else {
|
||||
echo '<P>SQL error, please contact the webmaster.';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue