if (isset($_GET['k']))
{
$k=$_GET['k'];
$query="SELECT * FROM `upload` WHERE `keywords` LIKE '%$k%' ";
@mysql_connect("localhost","root","") or die("error");
mysql_select_db("lol") or die ("error");
$query= mysql_query($query);
$numrows=mysql_num_rows($query);
if($numrows >0)
{
while ($row =mysql_fetch_assoc($query))
{
$keywords=$row['keywords'];
$name2=$row['name2'];
$URL=$row['URL'];
echo "<h2><a href='$URL'>$name2</a></h2><br/><br/>";
}
}
else
echo "no result found";
}
else
{
echo "please enter some value in search";
}
?>
I am making a simple search engine The issue is that if don't pass a value in search bar it shows all the results from database .To make it correct I use ISSET but it is not working plz help me me for this. Here is the attached code
0 comments:
Post a Comment