Hello,
I created a search function on my website that works fantastic but I would like to add an extra option.
I use this search function to search into a product database. Sometimes it happens that a product is temporarily not available and so i would like to hide this in the search results.
I would like to add an extra field “hide” in my table with the value “yes” or “no”, how can i tell my search script that it only must show the results with the hide value to “no” ?
<?php
mysql_connect("localhost","**********","**********");
mysql_select_db("**********");
$search = $_POST["search"];
$search = mysql_real_escape_string($search);
$result = mysql_query("SELECT * FROM articles_shop WHERE brand LIKE '%" . $search . "%' or type LIKE '%" . $search . "%'"); if($search == ""){
print "please enter something";
}else{
if(mysql_num_rows($result) > 0) {
while($r=mysql_fetch_array($result)) {
$brand = $r["brand"];
$type = $r["type"];
print "$brand $type<br><br>";
}
} else {
print "Nothing found";
}
}
?>