Showing posts with label php Search using php isset not working. Show all posts
Showing posts with label php Search using php isset not working. Show all posts

Search using php isset not working

Wednesday, November 4, 2015
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