ช่วยดูโค๊ตแบ่งหน้าทีคับ
คือมันแบ่งหน้าได้อ่ะคับ แต่ว่าเวลาคลิ๊กหน้าอื่นๆมันไม่แสดงข้อมูลคับ ไม่รู้ว่าผิดตรงไหนคับ
<?
$id_subject =$_SESSION['id_subject'];
$id_type=$_POST[id_type];
$day=$_POST[day];
$month=$_POST[month];
$year=$_POST[year];
$day2=$_POST[day2];
$month2=$_POST[month2];
$year2=$_POST[year2];
include "startconnect.inc";
$strSQL = "SELECT * FROM data where date >= '$year-$month-$day' and date <= '$year2-$month2-$day2'";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 20; // 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;
}
$strSQL .=" order by date desc LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
?>
</span>
<span class="style3">
<?
echo "<P><B>ข้อมูล</B></P>
<table border='1'>
<tr BGCOLOR='#E8E8E8'>
<td><center><b>เลขที่</b></center></td>
<td><center><b>วันที่</b></center></td>
<td><center><b>บัญชี</b></center></td>
<td><center><b>จำนวนเงิน</b></center></td>
<td><center><b>[แก้ไข]</b></center></td>
<td><center><b>[ลบ]</b></center></td>
<td><center><b>[ดูข้อมูล]</b></center></td>
</tr>";
while($row=mysql_fetch_array($objQuery)){
$iddata=$row[iddata];
$date=$row[date];
$money=$row[money];
$idaccount=$row[idaccount];
$sql2="select account from account where idaccount='$idaccount'";
$table2=mysql_query($sql2,$Conn) or die ("ไม่สามารถเรียกดูข้อมูลในเทเบิลได้");
$row2=mysql_fetch_array($table2);
$account=$row2[account];
echo "
<tr>
<td>$iddata</td>
<td>$date</td>
<td>$account</td>
<td>$money</td>
<td><a href=\"edit_budget.php?id_edit=$iddata\">[แก้ไข]</a></td>
<td><a href=\"delete_budget.php?id_del=$iddata\"onclick=\"return confirm('ยืนยันการลบเลขที่ใบสำคัญ $iddata ออกจากระบบ')\">[ลบ]</a></td>
<td><a href=\"view_budget.php?id_view=$iddata\">[ดูข้อมูล]</a></td>
</tr>";
}
echo "</table>";
?>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
}
?>
<?
$id_subject =$_SESSION['id_subject'];
$id_type=$_POST[id_type];
$day=$_POST[day];
$month=$_POST[month];
$year=$_POST[year];
$day2=$_POST[day2];
$month2=$_POST[month2];
$year2=$_POST[year2];
include "startconnect.inc";
$strSQL = "SELECT * FROM data where date >= '$year-$month-$day' and date <= '$year2-$month2-$day2'";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 20; // 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;
}
$strSQL .=" order by date desc LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
?>
</span>
<span class="style3">
<?
echo "<P><B>ข้อมูล</B></P>
<table border='1'>
<tr BGCOLOR='#E8E8E8'>
<td><center><b>เลขที่</b></center></td>
<td><center><b>วันที่</b></center></td>
<td><center><b>บัญชี</b></center></td>
<td><center><b>จำนวนเงิน</b></center></td>
<td><center><b>[แก้ไข]</b></center></td>
<td><center><b>[ลบ]</b></center></td>
<td><center><b>[ดูข้อมูล]</b></center></td>
</tr>";
while($row=mysql_fetch_array($objQuery)){
$iddata=$row[iddata];
$date=$row[date];
$money=$row[money];
$idaccount=$row[idaccount];
$sql2="select account from account where idaccount='$idaccount'";
$table2=mysql_query($sql2,$Conn) or die ("ไม่สามารถเรียกดูข้อมูลในเทเบิลได้");
$row2=mysql_fetch_array($table2);
$account=$row2[account];
echo "
<tr>
<td>$iddata</td>
<td>$date</td>
<td>$account</td>
<td>$money</td>
<td><a href=\"edit_budget.php?id_edit=$iddata\">[แก้ไข]</a></td>
<td><a href=\"delete_budget.php?id_del=$iddata\"onclick=\"return confirm('ยืนยันการลบเลขที่ใบสำคัญ $iddata ออกจากระบบ')\">[ลบ]</a></td>
<td><a href=\"view_budget.php?id_view=$iddata\">[ดูข้อมูล]</a></td>
</tr>";
}
echo "</table>";
?>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
}
?>