PHP: If no Results - Split the Searchrequest and Try to find Parts of the Search
Posted
by elmaso
on Stack Overflow
See other posts from Stack Overflow
or by elmaso
Published on 2010-04-01T18:18:03Z
Indexed on
2010/04/01
18:23 UTC
Read the original article
Hit count: 376
Hello, i want to split the searchrequest into parts, if there's nothing to find. example: "nelly furtado ft. jimmy jones" -> no results -> try to find with nelly, furtado, jimmy or jones.. i have an api url.. thats the difficult part.. i show you some of the actually snippets:
$query = urlencode (strip_tags ($_GET[search]));
and
$found = '0';
if ($source == 'all')
{
if (!($res = @get_url ('http://api.example.com/?key=' . $API . '&phrase=' . $query . ' . '&sort=' . $sort)))
{
exit ('<error>Cannot get requested information.</error>');
;
}
how can i put a else request in this snippet, like if nothing found take the first word, or the second word, is this possible? or maybe you can tell me were i can read stuff about this function?
thank you!!
© Stack Overflow or respective owner