|
|
|
PHP กด next แล้วค่า Query ไม่มา รบกวนช่วยดูหน่อยค่ะ |
|
|
|
|
|
|
|
PHP กด next แล้วค่า Query ไม่มา รบกวนช่วยดูหน่อยค่ะ
คือว่าต้องการกด Next เพื่อให้แสดงผลต่อ แต่ลอง echo ออกมาแล้วกลับไม่มีค่า เลยงงว่าติดที่ตรงไหนค่ะ
Code (PHP)
<?php
ob_start();
header("Cache-Control: no-cache, must-revalidate");
session_start();
include "connect.php";
$objConnect = mysqli_connect($host, $user, $password, $dbName);
mysqli_set_charset($objConnect,'utf8');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<meta charset="windows-874">
<title></title>
</head>
<body>
<?php
if (!isset($_SESSION['id']))
{
?>
<SCRIPT LANGUAGE="JavaScript">
window.location="index.php";
</SCRIPT>
<?php
}
?>
<div class="show_detailHos">
<?
$db = mysqli_connect($host, $user, $password, $dbName);
mysqli_set_charset($db,'utf8');
$a = $_GET["HOS_ID"];
echo $a . "RRRR";
$strSQL = "SELECT SOFTFILE_ID,DATE_FORMAT(SOFTFILE_DATE_DOC,'%d/%m/%Y') AS NSOFTFILE_DATE_DOC,SOFTFILE_HOS,SOFTFILE_PDF,SOFTFILE_REMARK, DATE_FORMAT(SOFTFILE_DATE,'%d/%m/%Y') AS NSOFTFILE_DATE ,SOFTFILE_USER,SOFTFILE_STATUS,SOFTFILE_DATE_D,SOFTFILE_USER_D FROM softfile where SOFTFILE_HOS = $a and SOFTFILE_STATUS = 'A' ";
echo $strSQL;
$objQuery = mysqli_query($db,$strSQL);
$Num_Rows = mysqli_num_rows($objQuery);
$Per_Page = 5; // 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;
echo "Step 2 -->";
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
echo "Step 3 -->";
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
echo "Step 4 -->";
}
$strSQL .=" order by NSOFTFILE_DATE_DOC DESC LIMIT $Page_Start , $Per_Page";
$objQuery = mysqli_query($objConnect,$strSQL);
echo "Step 5 -->";
?>
<table width="720" border="1">
<tr>
<th width="100">Uploade</th>
<th width="100">Doc Date</th>
<th width="250">Remark</th>
<th width="70">File Name</th>
</tr>
<?
while($objResult = mysqli_fetch_array($objQuery))
{
echo "Step 6 -->";
?>
<tr>
<td><?=$objResult["NSOFTFILE_DATE"];?></td>
<td><?=$objResult["NSOFTFILE_DATE_DOC"];?></td>
<td class="remark">
<?=$objResult["SOFTFILE_REMARK"];?>
</td>
<td>
<a target=_blank href="myfile/<?=$objResult["SOFTFILE_PDF"];?>"><?php echo "<img src=\"img/shoflotfile/documents_icon.png\" height=35 width=35>"; ?></a>
</td>
</tr>
<?php
}
?>
</table>
Total<?= $Num_Rows;?>
Record :<?=$Num_Pages;?>
Page :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'&h=$a><< Back</a> ";
echo "Step 7 -->";
}
for($i=1; $i<=$Num_Pages; $i++)
{
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&h=$a'>$i</a> ]";
echo "Step 8 -->";
}
else
{
echo "<b> $i </b>";
echo "Step 9 -->";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&h=$a'>Next>></a> ";
echo "Step 10 -->";
}
mysqli_close($objConnect);
?>
</body>
</html>
Tag : MySQL
|
|
|
|
|
|
Date :
2014-01-27 10:11:09 |
By :
kikkuk |
View :
738 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
echo $strSQL;
เอาค่า SQL ออกมาดูหน่อยครับ
|
|
|
|
|
Date :
2014-01-27 12:38:30 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
นี่เป็นรูปก่อนและหลังจากกด Next ค่ะ
|
|
|
|
|
Date :
2014-01-27 13:04:33 |
By :
kikkuk |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|