ขึ้นออเร่อ Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\TPFC\TPFC\index.php on line 116 หลังจากเพิ่ม order by Id_project desc รบกวนช่วยดูให้หน่อยค่ะ
ลองดูครับ ถ้าหากได้ก็ลองไล่ดูว่าต่างกันตรงไหน
Code (PHP)
<?php
include"./admin/connection.php";
$strSQL = " SELECT * FROM project ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 3; // 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 Id_project ASC LIMIT $Page_Start , $Per_Page ";
$objQuery = mysql_query($strSQL);
echo"<table border=\"2\" cellspacing=\"\" cellpadding=\"0\" bgcolor=\"#FFFFFF\" ><tr>";
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
echo "<td>";
$intRows++;
?>
<p class="imgholder">
<img src="images/<?php echo $objResult["img_project"];?>" alt="" width="286" height="100"/></p>
<h2><font size="3"><?php echo $objResult["Name_project"];?></font></h2>
<h2><textarea cols="38" rows="4" ><?php echo $objResult["lit_project"];?></textarea></h2>
<p class="readmore"><a href="#">Read More »</a></p>
</li>
</ul>
<?php
echo"</td>";
if(($intRows)%4==0)
{
echo"</tr>";
}
}
echo"</tr></table>";
?>
<center><br>
Total <?php echo $Num_Rows;?> Record : <?php echo $Num_Pages;?> Page :
<?php
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> ";
}
?>
<?php
mysql_close($objConnect);
?>
Date :
2017-11-07 16:53:31
By :
arm8957
ขอบคุณค่ะ ได้แล้วค่ะ
Date :
2017-11-09 15:59:49
By :
angsumarin
Load balance : Server 01