<form name="form1" method="post" action=""> ราคา <select name="price1" > <option value="0">ตั้งแต่</option> <option value="100">100</option> <option value="200">200</option> <option value="300">300</option> <option value="400">500</option> </select> ถึง <select name="price2"> <option value="500">ถึง</option> <option value="100">100</option> <option value="200">200</option> <option value="300">300</option> <option value="400">400</option> <option value="500">500</option> </select> </font> <input type="submit" name="Submit" value="Submit"> </form> <table width="600" border="0" cellpadding="0" cellspacing="0"> <tr> <td>ที่</td> <td>รหัสสินค้า</td> <td>ชื่อสินค้า</td> <td>ราคา</td> </tr> </table> <? $price1=trim($price1); $price2=trim($price2); if ($price1>$price2){echo "เลือกช่วงราคาไม่ถูกต้อง กรุณาเลือกใหม่";} else { include "connect/connect.php"; $sql = "select * from table_price,table_product where (table_price.price>='$price1' and table_price.price<='$price2' ) and ($table_price.id_product=$table_product.id_product) "; $dbquery = mysql_db_query($db,$sql); $num_rows = mysql_num_rows($dbquery); $i=1; while ($i<$num_rows){ $result=mysql_fetch_array($dbquery); $id_product=$result[id_product]; $product_name=$result[product_name]; $price=$result[price]; ?> <table width="600" border="0" cellpadding="0" cellspacing="0"> <tr> <td><? echo $i; ?></td> <td><? echo $id_product;?></td> <td><? echo $product_name;?></td> <td><? echo $price;?></td> </tr> </table> <? $i++;}?>
<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form name="form1" method="post" action=""> ราคา <select name="price1" > <option value="0">ตั้งแต่</option> <option value="100">100</option> <option value="200">200</option> <option value="300">300</option> <option value="400">500</option> </select> ถึง <select name="price2"> <option value="500">ถึง</option> <option value="100">100</option> <option value="200">200</option> <option value="300">300</option> <option value="400">400</option> <option value="500">500</option> </select> </font> <input type="submit" name="Submit" value="Submit"> </form> <table width="600" border="0" cellpadding="0" cellspacing="0"> <tr> <td>ที่</td> <td>ชื่อสินค้า</td> <td>รายละเอียด</td> <td>ราคา</td> </tr> </table> <? $price1=trim($price1); $price2=trim($price2); if ($price1>$price2){echo "เลือกช่วงราคาไม่ถูกต้อง กรุณาเลือกใหม่";} else { include "connect/connect.php"; $sql = "select * from price,product where (price.price>='$price1' and price.price<='$price2' ) and ($price.pro_id=$product.pro_id) "; $dbquery = mysql_db_query($db,$sql); $num_rows = mysql_num_rows($dbquery); $i=1; while ($i<$num_rows){ $result=mysql_fetch_array($dbquery); $pro_id=$result[pro_id]; $pro_name=$result[pro_name]; $price=$result[price]; ?> <table width="600" border="0" cellpadding="0" cellspacing="0"> <tr> <td><? echo $i; ?></td> <td><? echo $pro_name;?></td> <td><? echo $pro_detail;?></td> <td><? echo $price;?></td> </tr> </table> <? $i++;}?> </body> </html>
<? $host="localhost"; $user="root"; $pw="root"; $dbname="otop"; $sql = mysql_connect($host,$user,$pw); if (!$sql){ echo "<h3>ERROR : ไม่สามารถติดต่อฐานข้อมูลได้</h3>"; exit(); } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง