A search for
will bring up all movies that have either "american" or "men" in the title (this is good)american men
However, there is one problem. There is no way to search for a keyphrase instead of multiple keywords. I'm sure there's a way, but not one that i can think of that would allow them to search
and come up with something that requires both. Sort of how most search engines work."american men"
Here's my code:
Code: Select all
if($_POST['title'] != ""){
$title = explode(" ", strip_tags(mysql_real_escape_string($_POST['title'])));
$movies = array();
foreach($title as $value){
$sql = "SELECT * FROM `videos` WHERE `tags` LIKE '%$value%'";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
if(!in_multi_array($row, $movies)){
$movies[] = $row;
}
}
}
}