<? mysql_connect("localhost","root","root"); mysql_select_db("cartoon"); $strSQL = "SELECT * FROM product,typeproduct WHERE product.type_id=typeproduct.type_id"; $objQuery = mysql_query($strSQL) or die(mysql_error()); $Per_Page =3; /* ตั้งค่า แสดงผลต่อหน้า $Per_Page */ if(!$Page) $Page=1; $Prev_Page = $Page-1; $Next_Page = $Page+1; $result = mysql_query($strSQL); $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>"; $query1 = "select * from product order by p_id desc LIMIT $Page_start , $Per_Page "; $result1=mysql_query($query1); $number1=mysql_num_rows($result1); $i1 = 0; while ($i1 < $number1 ){ $row1 = mysql_fetch_array($result1); $i1++; $name = $row1[name]; $main = $row1[main]; $id = $row1[id]; } ?> <tr> <td width="710" bgColor="#669900" colSpan="2" height="9"> <table width="845" border="1" align="center" cellspacing="0" bordercolor="#000000"> <tr> <td width="101" bgcolor="#CCCCCC"><div align="center">รูป</div></td> <td width="84" align="center" bgcolor="#CCCCCC">รหัสสินค้า</td> <td width="213" align="center" bgcolor="#CCCCCC">ชื่อวัสดุ</td> <td width="95" align="center" bgcolor="#CCCCCC">ประเภทวัสดุ</td> <td width="72" align="center" bgcolor="#CCCCCC">ขนาด</td> <td width="136" align="center" bgcolor="#CCCCCC">ราคาต่อหน่วย</td> <td width="114" align="center" bgcolor="#CCCCCC">Cart</td> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><img src="<?=$objResult["p_img"];?>" width="100" height="120"> </td> <td align="center" valign="top"><?=$objResult["p_id"];?></td> <td align="center" valign="top"><?=$objResult["p_name"];?></td> <td align="center" valign="top"><?=$objResult["type_name"];?></td> <td align="center" valign="top"><?=$objResult["p_status"];?></td> <td align="center" valign="top"><?=$objResult["p_price"];?> บาท </td> <td align="center" valign="top"><a href="order.php?ProductID=<?=$objResult["p_id"];?>">เลือกรายการเบิก</a></td> </tr> <? } ?> </table> <div align="center"><br> <? echo"<blockquote><font face=\"MS Sans Serif\" size=\"2\" color=\"#FFFFFF\">"; ?> รายการหนังสือทั้งหมด<b><font color="#FFFFFF"> [ </font> <font color="#FFFFFF"> <?= $Num_Rows;?> </font> <font color="#FFFFFF"> ] </font> </b> บริษัท<br>แสดงเป็น : <b><font color="#FFFFFF"> [ <font color="#FFFFFF"> <?=$Num_Pages;?> </font><font color="#FFFFFF"> ]</font> </b><font color="#FFFFFF"> หน้า : <font color="#FFFFFF"> <?/* สร้างปุ่มย้อนกลับ */ if($Prev_Page) echo " <a href='$PHP_SELF?Page=$Prev_Page'><< ย้อนกลับ </a>"; for($i=1; $i<$Num_Pages; $i++){ if($i != $Page) echo "[<a href='$PHP_SELF?Page=$i'>$i</a>]"; else echo "<b> $i </b>"; } /*สร้างปุ่มเดินหน้า */ if($Page!=$Num_Pages) echo "<a href ='$PHP_SELF?Page=$Next_Page'> หน้าถัดไป>> </a></blockquote>"; ?> <p><a href="type_product.php">กลับ</a></p> <br> <a href="show.php">ดูรายการที่เบิก</a> |<? mysql_close(); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง