I found a script from http://www.roscripts.com/PHP_search_engine-119.html, I have succesfully set this up almost completely. I have a few final issues that I cannot seem to fix. I think I know what they are but I can't figure out how to resolve them. The error I recieve is "mysql_fetch_array(): supplied argument is not a valid MySQL result resource". The code is as follows below:
$sql = "SELECT DISTINCT COUNT(*) As occurrences, title, description, fulldescr FROM video_search WHERE (";
while(list([COLOR="red"]$key[/COLOR],[COLOR="red"]$val[/COLOR])=each($split_stemmed)){
if([COLOR="red"]$val[/COLOR]<>" " and strlen([COLOR="red"]$val[/COLOR]) > 0){
$sql .= "(title LIKE '%'.[COLOR="red"]$val[/COLOR].'%' OR subtitle LIKE '%'.[COLOR="red"]$val[/COLOR].'%' OR content LIKE '%'.[COLOR="red"]$val[/COLOR].'%') OR";
}
}
$sql=substr($sql,0,(strLen($sql)-3));//this will eat the last OR
$sql .= "[COLOR="Red"])[/COLOR] GROUP BY id ORDER BY occurrences DESC";
Now, I see three issues:
The ( and ) in red I believe are misplaced but I have tried deleting and moving them outside of the quote and it doesn't work. IF I move it outside of the quote PHP matches them up however I then get a PHP error.
THe $key in red is only found right there and no where else in the code that I got. It seems that it would have to be defined somewhere, however I cannot figure out what it should be defined as.
The $val in red is also only found in this section of code and one would think it would need to be defined. I believed it should have been replaced with what is the variable for the form used to perform the search or in my case $find. However replacing it with that doesn't help. I still recieve the exact same error.
Please, any help would be wonderful or point me to a better search engine code that can be used to accomplish seperating and searching multiple words, and dropping the plurals from words and so on.
Thank you in advance,
Ryan