include("includes/connect.inc.php");
include("includes/functions.inc.php");
include("includes/config.inc.php");
mysql_select_db($db);
date_default_timezone_set('America/Jamaica');
if(isset($_GET['id'])){
$id=(int)$_GET['id'];
}
if(!isset($id)){
echo $HEADER_ERROR;
}
$query="select * from articlenew where ArticleID=$id";
$result=mysql_query($query)or die ($HEADER_ERROR);
//store the total number of records here
$numrows=mysql_num_rows($result);
if($numrows == 0){
echo "
Sorry, article does not exist anymore
";
exit;
}
//get Article Information
while ($row = mysql_fetch_object($result)){
$ArticleTitle=$row->ArticleTitle;
$ArticleTitle=stripslashes($ArticleTitle);
$ArticleTeaser=$row->ArticleTeaser;
$ArticleTeaser=stripslashes($ArticleTeaser);
$ArticleBody=$row->ArticleBody;
$ArticleBody=stripslashes($ArticleBody);
$ArticleBody = str_replace("\n","
",$ArticleBody);
$ArticleAddDate=$row->ArticleAddDate;
$ArticleAddDate=stripslashes($ArticleAddDate);
$yyyy=substr($ArticleAddDate,0,4);
$mm=substr($ArticleAddDate,5,2);
$dd=substr($ArticleAddDate,8,2);
$ArticleAddDate = date ("F d, Y", mktime(0,0,0,$mm,$dd,$yyyy));
}
//Get Article Images
$query="SELECT ImageName, ImageCaption, ImageDefault, ArticleID FROM articleimages WHERE ArticleID=$id ORDER BY ImageDefault Asc";
$result=mysql_query($query)or die (mysql_error());
if (mysql_num_rows($result)>0){
$imagename=array();
$imagecaption=array();
$imageDefault=array();
$i=0;
while ($row = mysql_fetch_object($result)){
$imagename[$i]=stripslashes($row->ImageName);
$imagecaption[$i]=stripslashes($row->ImageCaption);
$imagedefault[$i]=$row->ImageDefault;
$i++;
}
$imagenum=count($imagename);
}
include('tpl_view_article_details.php')
?>