<table width="539" border="0" align="center"> <tr> <th width="607"><h3 align="center"> <span class="style16"><span class="style15"> ค้นหาข้อมูลสมุนไพร</span></span><span class="style6"> </span> <input name="txtKeyword" width="200" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>"> <input name="submit" type="submit" value="ค้นหา" /> </h3></th> </tr> </table> </form> <? if($_GET["txtKeyword"] != "") { $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("herb"); // Search By Name or Email $strSQL = "SELECT * FROM data_herb WHERE (Herb_Name LIKE '%".$_GET["txtKeyword"]."%' or Herb_Properties LIKE '%".$_GET["txtKeyword"]."%' or Herb_NameSci LIKE '%".$_GET["txtKeyword"]."%' or Herb_NameFamily LIKE '%".$_GET["txtKeyword"]."%' or Herb_Botany LIKE '%".$_GET["txtKeyword"]."%')"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 3; // Per Page $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; } $strSQL .=" order by Herb_Name ASC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); function hiligth($keySearch,$myStrong) { $varlue=str_replace($keySearch,"<font color=red><b>$keySearch<b></font>",$myStrong); return $varlue; } while($objResult = mysql_fetch_array($objQuery)) { ?> <table width="200" border="0"> <tr> <td align="center"><div class="post"> <a href="list4.php"><img src="image/<?=$objResult['Herb_Image'];?>"width="196"height="114" /></a> </div></td> </tr> <tr> <td align="center"><div class="post"> <span class="style32"> <a href="list4.php"><?=hiligth($_GET["txtKeyword"],$objResult["Herb_Name"]);?></a> </span></div></td> </tr> </table> <? } ?> <br><br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo "<a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]' ><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]'>Next>></a> "; } ?> <? mysql_close($objConnect); } ?>
<table width="200" border="0"> <tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <td align="center"><div class="post"> <a href="list4.php"><img src="image/<?=$objResult['Herb_Image'];?>"width="196"height="114" /></a> </div></td> <td align="center"><div class="post"> <span class="style32"> <a href="list4.php"><?=hiligth($_GET["txtKeyword"],$objResult["Herb_Name"]);?></a> </span></div></td> <? } ?> </tr> </table>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง