mirror of
https://git.code.sf.net/p/quake/website
synced 2024-11-27 06:22:31 +00:00
fix lack of news
This commit is contained in:
parent
c7216d1d8e
commit
85571e0c30
1 changed files with 27 additions and 27 deletions
54
cur_news.php
54
cur_news.php
|
@ -1,27 +1,27 @@
|
|||
<?
|
||||
need('date sql');
|
||||
|
||||
$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 1 MONTH)' .
|
||||
' 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', '<P>No current news!');
|
||||
}
|
||||
} else {
|
||||
newsItem ('now', 'Web Server', '<P>No news in database!');
|
||||
}
|
||||
mysql_close ($conn);
|
||||
} else {
|
||||
newsItem ('Now', 'Web Server', '<P>Error: Could not connect to SQL server to fetch news. Please notify the server administrator.');
|
||||
}
|
||||
?>
|
||||
<?
|
||||
need('date sql');
|
||||
|
||||
$conn = @mysql_pconnect (sqlHost, sqlUser, sqlPass);
|
||||
if ($conn) {
|
||||
$query = 'SELECT n_date, n_user, n_news FROM news_main' .
|
||||
' ORDER BY n_date DESC';
|
||||
$result = @mysql_db_query (sqlDB, $query, $conn);
|
||||
if ($result) {
|
||||
$numRows = @mysql_num_rows ($result);
|
||||
if ($numRows) {
|
||||
if($numRows > 5) $numRows = 5;
|
||||
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', '<P>No current news!');
|
||||
}
|
||||
} else {
|
||||
newsItem ('now', 'Web Server', '<P>No news in database!');
|
||||
}
|
||||
mysql_close ($conn);
|
||||
} else {
|
||||
newsItem ('Now', 'Web Server', '<P>Error: Could not connect to SQL server to fetch news. Please notify the server administrator.');
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue