Got this script partially working, but if there are 3 tags on 1 video, and I type all 3 tags, the video comes back 3 times, not sure how to rectify this.
$search = sanitize($_GET['search']);
$array = explode(" ", $search);
foreach($array as $mySearch)
{
$query = mysql_query("SELECT * FROM `videos`");
while($mad = mysql_fetch_array($query))
{
if(strpos($mad['tags'], $mySearch))
{
// show results
echo "<div class='comment_1'>$mad[title]</div>";
}
}
}
Any help is always greatly appreciated.
Well that’s fine, however, scripts are like being pregnant: There is no partially. A system either works or not, not much between the lines.
You have a logical problem here, resulting from a wrong order of processing with your control structures.
The normal procedure is:
In your script you mix all these three things into each other instead of doing one part after the other: