|
 |
|
ถ้าต้องการสร้างlist ใหม่เพื่อแสดงผลการค้นข้อมูลจาก การค้นหาเดิมส่งค่ายังไงหรอค่ะ |
|
 |
|
|
 |
 |
|
Code (PHP)
<?
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."]");
?>
<?
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>//เปลี่ยนการแสดงผลเพียงเเค่ ฟิลนี้ เเล้วทำการลิงค์ไปอีก list ใหม่ ที่มีการแสดงผลทั้งหมด
<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);
}
?>
ถ้าเราตอ้งการ สร้าง list เพื่อแสดงผล ต้องสร้าง list.php ใหม่ยังไงหรอค่ะ เพื่อแสดงผลลัพธ์จากการค้นหาจากชื่อสมุนไพรที่เราคลิกมากก่อนหน้านี้
Tag : PHP, Ms SQL Server 2005

|
|
 |
 |
 |
 |
Date :
2010-11-05 19:04:37 |
By :
loverstrory |
View :
737 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ก็ทำเป็นลิ้งค์ไปสิครับ ส่งไปแบบ GET น่ะ
Code (PHP)
<?
print"<a href='abc.php?id=$abc'>test</a>";
?>
แล้วก็เอาค่าที่ส่งไป ไปค้นหาอีกทีหนึ่ง
ตอบถูกไหมหว่า
|
 |
 |
 |
 |
Date :
2010-11-05 23:29:36 |
By :
monotakari |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|