<body> <table width="600" height="411"> <tr> <td valign="top"> <table border=0 width="100%" style="margin-top:80px" > <tr> <td width="100%"> <?php $keyword = $_REQUEST["keyword"]; $query="SELECT top 100 * FROM booklist WHERE title + title1 LIKE '%".$_REQUEST["keyword"]."%' "; $result = odbc_exec($cid,$query); $Num_Rows = odbc_num_rows($result); // Pagination =========================================== // ====================================================== $Per_Page = 10; $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; } $Num_Pages = (int)$Num_Pages; $Page_End = $Per_Page * $Page; if ($Page_End > $Num_Rows) { $Page_End = $Num_Rows; } //========================================================= //========================================================= // test query ==================================== //=========================================== echo "<br>query = $query"; echo "<br>result = $result"; echo "<br>Num_Rows = $Num_Rows"; echo "<br>keyword = $keyword"; echo "<br>Page = $Page"; /*echo "<br>Num_Rows = $Num_Rows"; echo "<br>Per_Page = $Per_Page"; echo "<br>Page = $Page"; echo "<br>Prev_Page = $Prev_Page"; echo "<br>Next_Page = $Next_Page"; echo "<br>Page_Start = $Page_Start "; echo "<br>Num_Pages = $Num_Pages"; echo "<br>Page_End = $Page_End ";*/ //=========================================== $icount=1; for ($i=$Page_Start;$i<$Page_End;$i++) { $record = odbc_fetch_array($result,$i); $barcode = $record["barcode"]; $title = return_thai($record["title"]) . return_thai($record["title1"]); $author = return_thai($record["author"]); $translator = $record["translator"]; $price = $record["price"]; $found_book = false; $filename_1 = "../images/books/".$record["barcode"].".gif"; $filename_2 = "../images/books2/".$record["barcode"].".gif"; $icount++; if (($icount)%2==0){ echo "</tr></table><table width='100%' border='1'><tr>"; } echo "<td align='left' width='5%'><table><tr>"; echo "<td align='left' width='25%'>"; if (file_exists($filename_1)) { echo "<a href = 'description.php?barcode=$record[barcode]'><img src='../images/books/$record[barcode].gif' height=100 /></a><br>"; $found_book = true; } if (file_exists($filename_2)) { echo "<a href = 'description.php?barcode=$record[barcode]'><img src='../images/books/$record[barcode].gif' height=100 /></a><br>"; $found_book = true; } if( $found_book == false) { echo "<a href = 'description.php?barcode=$record[barcode]'><img src='../images/books/apology.gif' height=100 /></a><br>"; } echo "</td>"; echo "<td width='70%' >"; // Show book information // ================================================================================ echo $title . "<br>"; echo 'ผู้แต่ง/ผู้แปล : ' .$author. "<br>"; echo ' Barcode : ' .$barcode. "<br>"; echo "ราคาปก " . number_format($price,2) . " บาท<br>"; echo "<br><br>"; // Read Description from text file // ================================================================================ echo "</td>"; echo "</tr></table></td>"; } ?> </td> </tr> <tr> <td colspan="2" align="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&Keyword=$Keyword '><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&Keyword=$Keyword '>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&Keyword=$Keyword'>Next>></a> "; } ?> </td> </tr> </table> </td> </tr> </table> </body>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง