The selected news story could not be found. To view the latest news stories, please click here";
}
$sqlSTORY = "Select story.story_title, storytext.storytext, storytext.newsimage, story.story_date
From story, storytext
WHERE story.story_ID=storytext.storytext_ID
AND story.story_ID='$page'";
$sql_resultSTORY = mysql_query($sqlSTORY);
while ($rowSTORY = mysql_fetch_array($sql_resultSTORY)){
$titleSTORY = $rowSTORY["story_title"];
$fullstorySTORY = $rowSTORY["storytext"];
$imageSTORY = $rowSTORY["newsimage"];
$storydateSTORY = $rowSTORY["story_date"];
function date_format($storydateSTORY){
$sDateSTORY = substr($storydateSTORY, 8, 2);
$sDateSTORY = $sDateSTORY.substr($storydateSTORY, 4, 4);
$sDateSTORY = $sDateSTORY.substr($storydateSTORY, 0, 4);
$sDateSTORY = $sDateSTORY.substr($storydateSTORY, 10, 6);
return $sDateSTORY;
}
echo "$titleSTORY " . date_format($storydateSTORY) . " $sDateSTORY";
if ($imageSTORY) {
echo " ";
}
echo " ";
mysql_free_result($sql_resultSTORY);
}
elseif ($url_id == "airline") {
?>
No news stories could be found for the date selected. To view the latest news stories, please click here";
}
} else {
$storybydate = "SELECT DISTINCT story_date, COUNT(story_ID) AS NumSD
FROM story
GROUP BY story_date
ORDER BY story_date DESC, priority";
$storybydate_result = mysql_query($storybydate);
$SDmonthcheck = "none";
while ($rowsd = mysql_fetch_array($storybydate_result)){
$storydateSD = $rowsd["story_date"];
$NumStoryDate = $rowsd["NumSD"];
$SDmonth = substr($storydateSD, 5, 2);
if ($SDmonthcheck == 'none') {
// do nothing
} else {
if ($SDmonthcheck != $SDmonth) {
echo " ";
}
}
echo "";
if ($SDmonth == '12') {
echo "December ";
} elseif ($SDmonth == '11') {
echo "November ";
} elseif ($SDmonth == '10') {
echo "October ";
} elseif ($SDmonth == '09') {
echo "September ";
} elseif ($SDmonth == '08') {
echo "August ";
} elseif ($SDmonth == '07') {
echo "July ";
} elseif ($SDmonth == '06') {
echo "June ";
} elseif ($SDmonth == '05') {
echo "May ";
} elseif ($SDmonth == '04') {
echo "April ";
} elseif ($SDmonth == '03') {
echo "March ";
} elseif ($SDmonth == '02') {
echo "February ";
} elseif ($SDmonth == '01') {
echo "January ";
}
$SDmonthcheck = "$SDmonth";
echo substr($storydateSD, 8, 2);
echo " ";
echo substr($storydateSD, 0, 4);
echo " - $NumStoryDate transport news stories added. ";
}
}
}
elseif ($url_id == "201" OR $url_id == "202" OR $url_id == "209" OR $url_id == "205" OR $url_id == "203" OR $url_id == "204" OR $url_id == "206") {
$sqlcount= "Select story.story_url, story.story_title, story.story_desc, fromsite.fromsite_ID, fromsite.fromsite_url, fromsite.fromsite_title, story.story_date
From story, fromsite, typeofnews, type
WHERE story.fromsite_ID=fromsite.fromsite_ID
AND type.type_ID = '$url_id'
AND type.type_ID=typeofnews.type_ID
AND story.story_ID=typeofnews.news_ID
ORDER BY story.story_date DESC, story.priority, story.story_title";
$sql_countresult = mysql_query($sqlcount);
$totalrows = mysql_num_rows($sql_countresult);
if ($totalrows == 0) {
echo "The selected transport news section could not be found. To view the latest news stories, please click here";
}
if(empty($page)){
$page = 1;
}
$limitvalue1 = $page*$limit-($limit);
$sql = "Select story.story_url, story.story_title, story.story_desc, fromsite.fromsite_ID, fromsite.fromsite_url, fromsite.fromsite_title, story.story_date
From story, fromsite, typeofnews, type
WHERE story.fromsite_ID=fromsite.fromsite_ID
AND type.type_ID = '$url_id'
AND type.type_ID=typeofnews.type_ID
AND story.story_ID=typeofnews.news_ID
ORDER BY story.story_date DESC, story.priority, story.story_title
LIMIT $limitvalue1, $limit";
$sql_result = mysql_query($sql);
}
elseif ( $url_id == "all") {
$sqlcount= "Select story.story_url, story.story_title, story.story_desc, fromsite.fromsite_ID, fromsite.fromsite_url, fromsite.fromsite_title, story.story_date
From story, fromsite
WHERE story.fromsite_ID=fromsite.fromsite_ID
ORDER BY story.story_date DESC, story.priority, story.story_title";
$sql_countresult = mysql_query($sqlcount);
$totalrows = mysql_num_rows($sql_countresult);
if ($totalrows == 0) {
echo "The selected transport news section could not be found. To view the latest news stories, please click here";
}
if(empty($page)){
$page = 1;
}
$limitvalue1 = $page*$limit-($limit);
$sql = "Select story.story_url, story.story_title, story.story_desc, fromsite.fromsite_ID, fromsite.fromsite_url, fromsite.fromsite_title, story.story_date
From story, fromsite
WHERE story.fromsite_ID=fromsite.fromsite_ID
ORDER BY story.story_date DESC, story.priority, story.story_title
LIMIT $limitvalue1, $limit";
$sql_result = mysql_query($sql);
}
else
{
echo "The selected transport news section could not be found. To view the latest news stories, please click here";
}
if ($url_id == "201" OR $url_id == "202" OR $url_id == "209" OR $url_id == "205" OR $url_id == "203" OR $url_id == "204" OR $url_id == "206" OR $url_id == "all" OR $url_id == "pastnews" AND $page != "") {
function date_format($storydate){
$sDate = substr($storydate, 8, 2);
$sDate = $sDate.substr($storydate, 4, 4);
$sDate = $sDate.substr($storydate, 0, 4);
$sDate = $sDate.substr($storydate, 10, 6);
return $sDate;
}
while ($row = mysql_fetch_array($sql_result)){
$url = $row["story_url"];
$title = $row["story_title"];
$description = $row["story_desc"];
$fromid = $row["fromsite_ID"];
$fromurl = $row["fromsite_url"];
$fromtitle = $row["fromsite_title"];
$storydate = $row["story_date"];
$title = trim($title);
if($fromid == 124) {
$newwindow = "_parent";
} else {
$newwindow = "_blank";
}
echo "$title - From $fromtitle - $description " . date_format($storydate) . " $sDate ";
}
echo " ";
echo "";
if ($url_id != "pastnews") {
if($page != 1) {
$pageprev= $page - 1;
echo "PREV | "; // if page is not equal to one, prev goes to $page - 1
echo "$page";
} else {
}
} else {
echo "Select another date ";
}
if(($totalrows-($limit*$page)) > 0){
$pagenext = $page + 1;
echo " | NEXT"; // if the totalrows - $limit * $page is > 0 (meaning there is a remainder), leave the next button.
}
mysql_free_result($sql_result);
echo "";
}
?>
|
|