Hi all,
I've written a simple search page and all seems to be working fine.
However a frind of mine asked why didnt I make it accpet more than 1 keyword![]()
Ive seen alot of sites around that allow multiple keyword searches by seperating them using commas.
Can someone shed a little light on this matter please.
Heres my simple output for a single keyword search:
PHP Code:$search=$_POST["search"];
if(get_magic_quotes_gpc()){
$search = stripslashes($search);
}
$search = mysql_real_escape_string($search);
$result = mysql_query("SELECT * FROM ".$tablelinkname."
WHERE
question LIKE '%$search%'
AND
answer LIKE '%$search%'");
if( mysql_num_rows($result) > 0 )
{
while($r=mysql_fetch_array($result))
{
$question=$r["question"];
$id=$r["id"];
$cid=$r["cid"];
echo " <a class='content_padding' href='read.php?cid=".$r['id']."'>".$r['question']."</a>";
}
echo "
";
}
else
{
echo "<p class='content_padding'><img src='img/caution.gif' align='top'/> Your search returned no results,
try using different key words.</p>";
}
?>





Bookmarks