I have a search get variable that can contain multiple words which are space deliminated. I have used the following to script to grab the url variable. Notice for the example I have just used a string for simplicity.
What I have tried to do is explode the variable value and then add on the needed sql before and after.
The echo works fine. It is this echo that I need as a variable in a sql within the code that follows.
My problem is that it just returns the last query metal when I reference it outside within the query as a string. I am so new to this, please any help would appreciated.
<?php
$string = "kitchens wooden metal";
$splitted = explode(" ",$string);
$cnt = count($splitted);
$i=0;
while($cnt > $i)
{
$sqlsnippet = "cats_sub.cats_sub_ms_desc LIKE %$splitted[$i]%";
$i++;
echo $sqlsnippet;
}
?>