To be clear, I need to search the table in database, specifically field called tags
which is defined as text. Into the database, I am entering those 'tags' as a string and then I am exploding / dividing this string of 'tags' by explode()
method into array in php
. But for search of multiple 'tags' in form I need to enter multiple tags divided by SPACE and then by #.
Problem is that I do not know how to tell database to ignore order of entered tags and display all pictures which contains entered tags in search form ignoring the order of entered tags. Until now I was able to search only pictures where tags were in order.
I have tried to do it this way but it did not work
$search_string = $_POST['search'];
$exploded_search_string = explode(" ", $search_string);
$sql_search = "SELECT * FROM pictures
WHERE tags LIKE '%".$exploded_search_string."%'
ORDER BY ID_picture DESC";