What I'm trying to do is to display all possible variations in the table on the screen. If $search = str
, to search in the table for every word which contains 'str' in it. I tried a lot of variations to do it, but without success yet. What is wrong, and can i use something like "SELECT * FROM table WHERE * LIKE '[[:<:]]\"$search\"[[:>:]]' "
?
$string = "SELECT * FROM table
WHERE (column1 = '[[:<:]]\"$search\"[[:>:]]')
OR (column2 = '[[:<:]]\"$search\"[[:>:]]')
OR (column3 = '[[:<:]]\"$search\"[[:>:]]')
OR (column4 = '[[:<:]]\"$search\"[[:>:]]')
OR (column6 = '[[:<:]]\"$search\"[[:>:]]')
OR (column7 = '[[:<:]]\"$search\"[[:>:]]')";
Question: find all words that contain 'str'