<?
if (empty($keyword))
{
echo"<B>กรอกชื่อสินค้า</B>";
exit();
}
$host="localhost";
$username="root";
$pass_word="";
$db="dbchai";
$tb="product";
mysql_connect( $host,$username,$pass_word) or die ("ติดต่อกับฐานข้อมูล Mysql ไม่ได้ ");
mysql_select_db($db) or die("เลือกฐานข้อมูลไม่ได้");
$sql = "SELECT b.*,b.* FROM product a LEFT JOIN company b ON a.com_id = b.com_id WHERE a.pro_title LIKE '%$keyword%'";
$sql = "SELECT b.*,b.* FROM product a LEFT JOIN company b ON a.com_id = b.com_id WHERE a.pro_title LIKE '%$keyword%' order by pro_id asc LIMIT $Page_start , $Per_Page";
//ส่วนแสดงผล
$result = mysql_query($sql);
?>
<br>
<br>
</font>
<table width="89%" border="0" cellspacing="1" cellpadding="1" height="37" align="center">
<tr bgcolor="#CAE4FF">
<td width="34%" height="26" bgcolor="#0099FF"> <div align="center"><font color="#FFFFFF" size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">บริษัท / ตัวแทนจำหน่าย </font></div></td>
<td width="31%" height="26" bgcolor="#0099FF"> <div align="center"><font color="#FFFFFF" size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ชื่อสินค้า</font></div></td>
<td width="14%" height="26" bgcolor="#0099FF"> <div align="center"><font color="#FFFFFF" size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ระยะประกัน</font></div></td>
<td width="21%" height="26" bgcolor="#0099FF"> <div align="center"><font color="#FFFFFF" size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ราคา</font></div></td>
</tr>
</table>
<font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
<?
While($row= mysql_fetch_array($result)){
$com_name = $row["com_name"];
$pro_title = $row["pro_title"];
$pro_time=$row["pro_time"];
$pro_price=$row["pro_price"];
?>
</font>
<table width="89%" border="0" cellspacing="1" cellpadding="1" height="26" align="center">
<tr bgcolor="#EAEAEA">
<td width="34%" height="21"> <div align="center"><font face="Microsoft Sans Serif, MS Sans Serif, sans-serif" size="-1">
<? echo $com_name;?> </font></div></td>
<td width="32%" height="21"> <div align="center"><font face="Microsoft Sans Serif, MS Sans Serif, sans-serif" size="-1">
<? echo $pro_title;?> </font></div></td>
<td width="13%" height="21"> <div align="center"><font face="Microsoft Sans Serif, MS Sans Serif, sans-serif" size="-1">
<? echo $pro_time;?> </font></div></td>
<td width="21%" height="21"> <div align="center"><font face="Microsoft Sans Serif, MS Sans Serif, sans-serif" size="-1">
<? echo $pro_price;?> </font></div></td>
</tr>
</table>
<font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
<? }?>
</font>
<div align="center"> <font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><br>
<font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><font color="#0000FF">พบทั้งหมด<b></b></font></font><font color="#0000FF"><b></b></font></font><font color="#0000FF"><b>
<?= $Num_Rows;?>
</b> </font><font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><font color="#0000FF">รายก</font></font><font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><font color="#0000FF">าร</font></font><font color="#0000FF">รวมทั้งหมด</font></font><font color="#0000FF"></font></font><font color="#0000FF">
: <b>
<?=$Num_Pages;?>
</b> </font><font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><font size="-1" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><font color="#0000FF">หน้า</font></font><font color="#0000FF"></font></font><font color="#0000FF">
:
<? /* สร้างปุ่มย้อนกลับ */
if($Prev_Page)
echo " <a href='$PHP_SELF?Page=$Prev_Page&keyword=$keyword'><< ย้อนกลับ </a>";
for($i=1; $i<$Num_Pages; $i++){
if($i != $Page)
echo "[<a href='$PHP_SELF?Page=$i&keyword=$keyword'>$i</a>]";
else
echo "<b> $i </b>";
}
/*สร้างปุ่มเดินหน้า */
if($Page!=$Num_Pages)
echo "<a href ='$PHP_SELF?Page=$Next_Page&keyword=$keyword'> หน้าถัดไป>> </a>";
mysql_close();
?>