الســـــــــــــــــــــلام عليكــــــــــــم ورحمة اللهـ وبركاتهـ
عملت كود لبحث بس يبحث في الداتابيس اما الصفحات ما يبحث فيها
وما عرفت كيف اخليه لما اكتب كلمه يظهر لي روابط كل الصفحات اللي فيها هذي الكلمه
ان شاء الله انكم فهمتوا عليا
<?php
$connectdb = mysql_connect('localhost','root','') or die ("mysql error");
$selectdb = mysql_select_db('DB',$connectdb) or die ("error");
echo'<form action="searchdb.php" method="get" >
<input type="text" name="search"/>
<input type="submit" value="search!!" width="20"/>
<input type="hidden" name="do" value="query"/>
</form>
echo '</div>';
echo '<br/>';$search = trim(strip_tags(mysql_real_escape_string($_GET['search'])));
if (isset($_GET['do']) and $_GET['do'] == 'query' ){
if (empty($search)){
echo " <br/>plz insert word for search ";
}else if (strlen($search)>=30 and strlen($search)<=3){
echo " <br/>the length of the word must be grater than 3 letters and less than 30 letters ";
}else
{
$data =mysql_query("select * from products WHERE productName LIKE '%$search%'");
$num =mysql_num_rows($data);
if ($num <1){
echo "not found";
}else {echo "<br/>result: <br/>";
echo '<center>
<table border=0 width=60% align="center">';
while ($row = mysql_fetch_assoc($data))
{echo '<tr>
<td rowspan = "2" align=center valign=top><br/><br/><img src="'; echo $row["pic"]; echo '"width=200 hight=300><br></td>
<th ><font face="arial" size=4 color=#663333>';echo $row["productName"]; echo'</font><br></th>
</tr>
<tr>
<td align=left valign=center>
<b><font face="arial" size=2 color=#FF6633><br/><br/> Price: SR '; echo $row["price"]; echo'</font></b><br/><br/>
<b><font face="arial" size=2 color=#FF6633>Shipping: SR '; echo $row["shipping"]; echo '</font></b><br/><br/>
<!-- <b><font face="arial" size=2 color=#FF6633>Product ID:'; echo $row["productID"]; echo '</font></b><br/><br/> -->
<!-- <P><FORM method="get">
Product ID: <input type=text size=2 maxlength=6 name=id value="333"/></FORM></p><br/><br/> -->
<a href="'; echo $row ['link'] ; echo'" > More about the product</a>
</td>
</tr>
<tr>
<td colspan="2"><br/><hr><br/></td>
</tr>
';}
echo'</table>
</center> '; }
}
}
?>