|
 |
|
รบกวนขอโค้ดการตัดหน้า ผลลัพธ์ในการค้นหาหน่อยน่ะค่ะ ทำไม่เป็นอ่าค่ะ ช่วยที |
|
 |
|
|
 |
 |
|
โค้ดค้นหาของเราประมาณนี้น่ะค่ะ ไม่ทราบว่าต้องเปลี่ยนค่ายังไงมั้ง
Code (PHP)
<form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="599" border="0">
<tr>
<th>ค้นหาข้อมูลสมุนไพร
<input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>">
<input type="submit" value="ค้นหา"></th>
</tr>
</table>
</form>
<?
if($_GET["txtKeyword"] != "")
{
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
// 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."]");
?>
<?
function hiligth($keySearch,$myStrong)
{
$varlue=str_replace($keySearch,"<font color=red><b>$keySearch<b></font>",$myStrong);
return $varlue;
}
while($objResult = mysql_fetch_array($objQuery))
{
?>
<div><strong>ชื่อสมุนไพร : </strong><?=hiligth($_GET["txtKeyword"],$objResult["Herb_Name"]);?> </div>
<div><strong>ชื่อวิทยาศาสตร์ : </strong><?=hiligth($_GET["txtKeyword"],$objResult["Herb_NameSci"]);?> </div>
<div><strong>ชื่อวงศ์ : </strong><?=hiligth($_GET["txtKeyword"],$objResult["Herb_NameFamily"]);?> </div>
<div><strong>ลักษณะทางฟฤกษศาสตร์ : </strong><?=hiligth($_GET["txtKeyword"],$objResult["Herb_Botany"]);?> </div>
<div><strong>สรรพคุณ : </strong><?=hiligth($_GET["txtKeyword"],$objResult["Herb_Properties"]);?> </div><BR><BR>
<?
}
?>
<?
mysql_close($objConnect);
}
?>
ขอบพระคุณล่วงน้าค่ะจำเป็นจิงๆ
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2010-11-01 17:36:26 |
By :
loverstrory |
View :
1441 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากค่ะ
^-^
|
 |
 |
 |
 |
Date :
2010-11-01 21:05:43 |
By :
loverstrory |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|