@session_start();?>
สำนักวิจัย มหาวิทยาลัยเจ้าพระยา
ข่าวประชาสัมพันธ์
include("config.php");
mysql_query("SET NAMES utf8");
$SQL1 = "SELECT * FROM news WHERE n_type='news' AND status='1' ";
$Query1 = mysql_query($SQL1) or die ("Error Query [".$SQL1."]");
$Num_Rows = mysql_num_rows($Query1);
$Per_Page = 10; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$oSQL .=" order by n_id desc LIMIT $Page_Start , $Per_Page";
$oQuery = mysql_query($oSQL);
?>
while($oResult = mysql_fetch_array($Query1)){?>
-
}?>
Total Record : Page :
if($Prev_Page)
{
echo " << Back ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ $i ]";
}
else
{
echo " $i ";
}
}
if($Page!=$Num_Pages)
{
echo " Next>> ";
}
mysql_close($objConnect);
?>