PHP Search Engine From Array Every Word In Search

torfastrole

New Member
I've put my DB in arrays (title and URL for this matter) and need a search engine for it. The search string and array is provided and I have designed some versions, but they don't work in a sense where if I were to search "PHP ro" it would output stuff that didn't care if it only fit "ro" or "PHP." The two arrays are \[code\]$xml_data["title"]\[/code\] and \[code\]$xml_data["id"]\[/code\]. Sorry that I used \[code\]$_POST\[/code\] instead of \[code\]$_GET\[/code\]; the URL is redirected and the\[code\]$_search = $_POST["search"];$search_array = explode(" ",$search);foreach($search_array as $sa) { for($i=0;$i<=count($xml_data["title"]);$i++) { $t = $xml_data["title"][$i]; $cur_array_num = array_search($t,$xml_data["title"]); if($sa != "") { $pos = strpos(strtolower($t), strtolower($sa)); if ($pos === false) { } else { $search_results[] = "<li><a href='http://www.qvcool.com/".$xml_data["id"][$i]."'>".$t."</a></li>"; } } } }\[/code\]
 
Back
Top