คือผมทำหน้า Dashboard ขึ้นมาแล้วครับ ทีนี้ผมทำให้มัน include หน้าเว็บอื่นๆเข้ามา เพื่อทำให้สามารถคลิกแล้วขึ้นในหน้าเดียวได้แล้วครับ
ตามภาพด้านล่างครับ

โดยหน้าที่ผมแสดงผลอยู่ภาพด้านบนเป็นลิงค์นี้ครับ
http://localhost/bookstore/application/index.php?file=catagory
โดยตอนผม include ผมทำอย่างนี้ครับ เวลาคลิกที่ลิงค์ไหน มันก็จะเป็น QueryString ครับ
<?php
$file = (! empty($_GET['file'])) ? $_GET['file'] : 'dashboard';
echo $file;
if ($file=="edithowtopay")
include ("howtopay/index.php");
if ($file=="editcontactus")
include ("contact/index.php");
if ($file=="changeads")
include ("editads/index.php");
if ($file=="catagory")
include ("catagory/index.php"); <<-- อยู่ที่นี่
?>
ทีนี้ มันก็แสดงผลได้ตามปกติครับ แต่ติดที่ว่า ตรง ส่วนแบ่งหน้า

เวลาคลิกที่เลขแล้ว มันเป็นอย่างนี้ครับ
http://localhost/bookstore/application/index.php?Page=2
http://localhost/bookstore/application/index.php?Page=3
http://localhost/bookstore/application/index.php?Page=4
มันไม่ยอมคลิกไปหน้าถัดไปครับแบบไป หน้า 2,3 อ่ะครับ

มันเป็นแบบนี้ครับ
อยากทราบว่ามันจะแก้ยังไงได้บ้างครับ
CODE ส่วนแบ่งหน้าครับ
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้ <?php
ini_set('display_errors', 1);
error_reporting(~0);
$conn = mysqli_connect("localhost","root","","kmutnb_shop_database");
$sql = "SELECT * FROM catagory_books";
$query = mysqli_query($conn,$sql);
$num_rows = mysqli_num_rows($query);
$per_page = 2; // Per Page
$page = 1;
if(isset($_GET["Page"]))
{
$page = $_GET["Page"];
}
$prev_page = $page-1;
$next_page = $page+1;
$row_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;
}
$row_end = $per_page * $page;
if($row_end > $num_rows)
{
$row_end = $num_rows;
}
$sql .= " ORDER BY id_catagory_books ASC LIMIT $row_start ,$row_end ";
$query = mysqli_query($conn,$sql);
?>
<table width="600" border="0" class="table table-striped">
<tr>
<th width="91"> <div align="center">หมายเลขหมวด</div></th>
<th width="98"> <div align="center">Name </div></th>
</tr>
<?php
while($result=mysqli_fetch_array($query,MYSQLI_ASSOC))
{
?>
<tr>
<td><div align="center"><?php echo $result["id_catagory_books"];?></div></td>
<td><?php echo $result["name_catagory"];?></td>
</tr>
<?php
}
?>
</table>
<br>
Total <?php echo $num_rows;?> Record : <?php echo $num_pages;?> Page :
<?php
if($prev_page)
{
echo " <a href='$_SERVER[PHP_SELF]?Page=$prev_page'><< Back</a> ";
}
for($i=1; $i<=$num_pages; $i++){
if($i != $page)
{
echo "[ <a href='$_SERVER[PHP_SELF]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($page!=$num_pages)
{
echo " <a href ='$_SERVER[PHP_SELF]?Page=$next_page'>Next>></a> ";
}
$conn = null;
?>
รบกวนสอบถาม การ include หน้าเว็บจากไฟล์อื่นเพื่อทำให้เป็นไฟล์เดียวโดย Query MYSQL ผ่านหน้านั้น
ตามภาพด้านล่างครับ
โดยหน้าที่ผมแสดงผลอยู่ภาพด้านบนเป็นลิงค์นี้ครับ
http://localhost/bookstore/application/index.php?file=catagory
โดยตอนผม include ผมทำอย่างนี้ครับ เวลาคลิกที่ลิงค์ไหน มันก็จะเป็น QueryString ครับ
<?php
$file = (! empty($_GET['file'])) ? $_GET['file'] : 'dashboard';
echo $file;
if ($file=="edithowtopay")
include ("howtopay/index.php");
if ($file=="editcontactus")
include ("contact/index.php");
if ($file=="changeads")
include ("editads/index.php");
if ($file=="catagory")
include ("catagory/index.php"); <<-- อยู่ที่นี่
?>
ทีนี้ มันก็แสดงผลได้ตามปกติครับ แต่ติดที่ว่า ตรง ส่วนแบ่งหน้า
http://localhost/bookstore/application/index.php?Page=2
http://localhost/bookstore/application/index.php?Page=3
http://localhost/bookstore/application/index.php?Page=4
มันไม่ยอมคลิกไปหน้าถัดไปครับแบบไป หน้า 2,3 อ่ะครับ
อยากทราบว่ามันจะแก้ยังไงได้บ้างครับ
CODE ส่วนแบ่งหน้าครับ
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้