add preliminary news searching... hopefully the rest will make it in later tonight

This commit is contained in:
Dan Olson 2000-06-13 02:44:18 +00:00
parent e5d3a3a989
commit fef584f5c7

View file

@ -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.';
}
}
?>