well, I don't know why the SQL server won't work, but I'll fix it up

to at least report errors correctly now.
This commit is contained in:
Dan Olson 2000-06-13 03:21:01 +00:00
parent 8f8541f020
commit c7216d1d8e

View file

@ -25,12 +25,10 @@
$today['year']--; $today['year']--;
} }
} }
function searchNews ($string) function searchNews ($string)
{ {
need ('sql'); need ('date sql');
echo '<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0"> <TR vAlign="top"> <TD colSpan="2">';
tableBoxHeader( 'black', tableHeadColor );
tableTitle( "Search Results", 1, tableHeadColor );
$search = "\'%$string%\'"; $search = "\'%$string%\'";
$conn = @mysql_pconnect (sqlHost, sqlUser, sqlPass); $conn = @mysql_pconnect (sqlHost, sqlUser, sqlPass);
@ -42,10 +40,16 @@ echo '<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0"> <TR vAlign
if ($result) { if ($result) {
$numRows = @mysql_num_rows ($result); $numRows = @mysql_num_rows ($result);
if ($numRows) { if ($numRows) {
echo '<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0">'.
' <TR vAlign="top"> <TD colSpan="2">';
tableBoxHeader( 'black', tableHeadColor );
tableTitle( "Search Results", 1, tableHeadColor );
for ($i = 0 ; $i < $numRows ; $i++) { for ($i = 0 ; $i < $numRows ; $i++) {
list ($n_date, $n_user, $n_news) = mysql_fetch_row ($result); list ($n_date, $n_user, $n_news) = mysql_fetch_row ($result);
newsItem (dateFromSQLDateTime ($n_date), $n_user, StripSlashes($n_news)); newsItem (dateFromSQLDateTime ($n_date), $n_user, StripSlashes($n_news));
} }
tableBoxFooter();
echo '</TD></TR></TABLE>';
} else { } else {
echo '<P>No news found matching "' . $string . '"\n'; echo '<P>No news found matching "' . $string . '"\n';
} }
@ -56,7 +60,5 @@ echo '<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0"> <TR vAlign
} else { } else {
echo '<P>SQL error, please contact the webmaster.'; echo '<P>SQL error, please contact the webmaster.';
} }
tableBoxFooter();
echo '</TD></TR></TABLE>';
} }
?> ?>