Hello to all people on forum.
I built web site with large database of some texts and for easier finding what you need on it, I wanted to include search engine!
I built it, but it only works accurate with one word. Problem is when I want to search few word!
If they are separated or in different order, search is failure.
Here's my code:
function trazi($table,$search) {
$sve = mysql_query("SELECT id,headline,whole FROM $table ORDER BY id DESC");
$data = "";
while($tmp = mysql_fetch_array($sve)) {
if(stristr($tmp['headline'], $search) || stristr($tmp['whole'], $search)) {
$data .= '<a href="www.mysite.com/' . $table . '_cur.php?id=' . $tmp[0] . '" target="_blank" style=" text-decoration:none; color:#1A5C1F; font-size: 13px;">';
$data .= '<p>' . $tmp[1] . '</p>';
$data .= '</a>';
}
}
return $data;
}
So, I want search to be success only if ALL words can be found in headline OR in whole (text)!!
Can you help me modify my code?! Thx anyway!