<?
//แสดงข่าวสาร/ประชาสัมพันธ์
if($_GET[category]){
$SQLwhere = " category=''".$_GET[category]."'' ";
$SQLwhere2 = " WHERE category=''".$_GET[category]."'' ";
}
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
$limit = 10 ;
$SUMPAGE = $db->num_rows(TB_NEWS,"id","$SQLwhere");
$page=$_GET[page];
if (empty($page)){
$page=1;
}
$rt = $SUMPAGE%$limit ;
$totalpage = ($rt!=0) ? floor($SUMPAGE/$limit)+1 : floor($SUMPAGE/$limit);
$goto = ($page-1)*$limit ;
$res[news] = $db->select_query("SELECT * FROM ".TB_NEWS." $SQLwhere2 ORDER BY id DESC LIMIT $goto, $limit ");
$count=0;
while($arr[news] = $db->fetch($res[news])){
if ($count==0) { echo "<TR>"; }
//ชื่อหมวดหมู่
$res[category] = $db->select_query("SELECT category_name FROM ".TB_NEWS_CAT." WHERE id=".$arr[news][category]." ");
$arr[category] = $db->fetch($res[category]);
?>
<TD width="25%" valign=top>
<TABLE width="100%">
<TR>
<TD><FONT COLOR="#990000"><B>
<?= ThaiTimeConvert($arr[news][post_date],"","");?> : <?=$arr[category][category_name];?>
</B></FONT></TD>
</TR>
<TR><TD height="3" ></TD></TR>
<TR>
<TD>
<A HREF="?name=news&file=readnews&id=<?=$arr[news][id];?>" target="_blank">
<IMG SRC="newsicon/<?=$arr[news][post_date];?>.jpg" WIDTH="80" HEIGHT="60" BORDER="0" ALIGN="left" class="topicicon"><B><?=$arr[news][topic];?></A></B>
<?NewsIcon(TIMESTAMP, $arr[news][post_date], "images/icon_new.gif");?>
<BR><?=$arr[news][headline];?>
</TD>
</TR>
<TR><TD height="3" ></TD></TR>
</TABLE>
</TD>
<?
$count++;
if (($count%_NEWS_COL) == 0) { echo "</TR><TR><TD colspan=2 height=\"1\" class=\"dotline\"></TD></TR>"; $count=0; }
}
$db->closedb ();
//จบการแสดงข่าวสาร
?>
เข้าชม : 348
|