<table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="417" height="310" valign="top"> <table width="415" border="0" align="center"> <tr> <td><strong> </strong> <table width="418" height="22" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01"> <tr> <td width="8"> <img src="image/menu01.jpg" width="8" height="22" alt=""></td> <td width="389" background="image/menu02.jpg"><div align="center"><strong> <?php //============ เลือกว่าเป็นหมวดอะไร $resultHeadPro=select("category","where 1=1 and CatID='".$_GET["CatID"]."'"); if(!$resultHeadPro) { //header("location:index.php"); } if($_GET["CatID"]!="") { echo "(".$resultHeadPro["CategoryName"].")"; } else { echo "(แสดงทั้งหมด)"; } ?> </strong> </div></td> <td width="9"> <img src="image/menu03.jpg" width="9" height="22" alt=""></td> </tr> </table> <strong> </strong></td> </tr> <tr> <td> </td> </tr> <tr> <td width="378"> <?php //============ เลือกรายการสินค้าออกมาแสดง $condition=""; if($_GET["CatID"] <> "") { $condition="and CatID='$_GET[CatID]' "; } echo"<table align=center><tr>"; $sql = "select * from product where 1=1 $condition "; /* ตั้งค่า แสดงผลต่อหน้า $Per_Page */ $Per_Page =6; if(!$Page) $Page=1; //============ คำนวณจำนวนหน้า $Prev_Page = $Page-1; $Next_Page = $Page+1; $result=mysql_query($sql); $Page_start = ($Per_Page*$Page)-$Per_Page; $Num_Rows = mysql_num_rows($result); 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; if(($Page>$Num_Pages) || ($Page<0)) print "<center><b>จำนวน $Page มากกว่า $Num_Pages ยังไม่มีข้อความ<b></center>"; $sql .= " order by ProductID DESC LIMIT $Page_start , $Per_Page"; //ส่วนแสดงผล $i=0; $query = mysql_query($sql); While($resutNewPro= mysql_fetch_array($query)){ $i++; echo "<td>"; ?> <table width="202" height="105" border="0" cellpadding="3" cellspacing="10"> <tr> <td height="60" valign="top"><div align="center"><a href="detail.php?CatID=<?=$resutNewPro["CatID"];?>&ProductID=<?=$resutNewPro["ProductID"];?>"><img src="picture/<?=$resutNewPro["Picture"];?>" width="140" height="105" border="0"></a></div></td> </tr> <tr> <td valign="top"><div align="center"> <a href="detail.php?CatID=<?=$resutNewPro["CatID"];?>&ProductID=<?=$resutNewPro["ProductID"];?>"> <?=$resutNewPro["ProductName"];?> </a><br> <font color="#FF0000"><strong>พิเศษ</strong></font> <?="(".number_format($resutNewPro["Price"], 2,'.',',');?> บาท)<br> </div></td> </tr> </table> <?php //============ แสดงแถวละ สอง echo"</td>"; if(($i)%3==0) { echo"</tr>"; } else { echo "<td>"; } } echo"</tr></table>"; if($i==0) { echo "<strong><center><font color=red>ไม่มีรายการสินค้า</font></center></strong>"; } ?> <hr width="98%" color="#f2f2f6"> <table width="376" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="183" colspan="10" class="boxtext">จำนวน <?=$Page;?> หน้า <b> <?=$Num_Pages;?> </b> ( <?= $Num_Rows;?> รายการ) </td> </tr> </table> <table width="98%" border="0" cellpadding="1" cellspacing="1"> <tr> <td> <?php /* สร้างปุ่มย้อนกลับ */ if($Prev_Page) echo " <a href='$PHP_SELF?Page=$Prev_Page&CatID=$_GET[CatID]' class='boxtext'><< Back </a> "; for($i=1; $i<$Num_Pages; $i++){ if($i != $Page) echo " [ <a href='$PHP_SELF?Page=$i&CatID=$_GET[CatID]' class='boxtext'>$i</a> ]"; else echo "<b> $i </b>"; } /*สร้างปุ่มเดินหน้า */ if($Page!=$Num_Pages) echo " <a href ='$PHP_SELF?Page=$Next_Page&CatID=$_GET[CatID]' class='boxtext'> Next >> </a>"; ?> </td> </tr> </table></td> </tr> </table> <p class="style59"> </p> <p class="style59"> </p> <p class="style59"> </p></td> </tr> </table>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง