php search engine
hi all,
i am having some problem with my search engine which i couldn't solve. whenever i keyed in a key word to search from my database but it just couldn't get the result(s) and just die off.
the final output for my result is:
couldn't execute query
when my code looks like this:
<?
mysql_connect("localhost","pbl_b","abtV7QKL5aRNI") ;
mysql_select_db("pbl_b");
$search=$_POST["SearchEngine"];
$result = mysql_query("SELECT * FROM search WHERE Desc LIKE '%$search%'") or die("couldn't execute query");
while($r=mysql_fetch_array($result)){
$title = $r['Title'];
$desc = $r['Desc'];
$link = $r['Link'];
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><h1>Result</h1><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY>
<p align ="Center"> The Keywords is <strong><? $_POST['SearchEngine'] ?> </strong>.</p></p>
<tr><td> </td>
</tr>
<tr><td> </td><td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<? echo "$_POST[Title] ";?> <br>
<? echo "$_POST[Desc]"; ?><br>
<? echo "$_POST[Link]"; ?><br>
</td>
</tr>
</table></td></tr>
<tr><td></td><td></td><td></td></tr>
</BODY></HTML>
all the naming for the fields are corrent from the html and the database. please tell me where the problem lies.
thanx
|