From a0a9a867cd8d5d53bac979f0029f4e8f125ed31a Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Sat, 17 Jun 2000 11:50:32 +0000 Subject: [PATCH] grr... --- index.php | 24 +++++++++++++++++++++++- news_funcs.php | 1 - 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 5d13525..f480f4a 100644 --- a/index.php +++ b/index.php @@ -10,7 +10,29 @@ tableBoxHeader( 'black', tableHeadColor ); tableTitle( 'Latest News', 1, tableHeadColor ); require("news_funcs.php"); - latestNews('1 month'); + $conn = @mysql_pconnect (sqlHost, sqlUser, sqlPass); + if ($conn) { + $query = 'SELECT n_date, n_user, n_news FROM news_main' . + " WHERE n_date > DATE_SUB(NOW(), INTERVAL $length)" . + ' 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 { + newsItem ('now', 'Web Server', '

No current news!'); + } + } else { + newsItem ('now', 'Web Server', '

No news in database!'); + } + mysql_close ($conn); + } else { + newsItem ('Now', 'Web Server', '

Error: Could not connect to SQL server to fetch news. Please notify the server administrator.'); + } tableBoxFooter(); ?> diff --git a/news_funcs.php b/news_funcs.php index 1eed17c..2387289 100644 --- a/news_funcs.php +++ b/news_funcs.php @@ -101,7 +101,6 @@ need('date sql'); $conn = @mysql_pconnect (sqlHost, sqlUser, sqlPass); - echo sqlHost . sqlUser . $conn; if ($conn) { $query = 'SELECT n_date, n_user, n_news FROM news_main' . " WHERE n_date > DATE_SUB(NOW(), INTERVAL $length)" .