...

View Full Version : PHP Search Engine



joeiscoolone
06-21-2006, 04:10 AM
Im trying to build a small PHP Search Engine that just searches your site. I just want to specify what tables I want it to search and rank by word occurrence. I looked at some sites on how to build one but I had trouble with them. Can someone tell me how to build a small PHP search Engine in PHP? Im not asking for a super complex PHP Search Engine just one that will search your site.

xconspirisist
06-21-2006, 04:55 AM
IS your website based on databases much? If you're searching articles, for example, apply "fulltext" to the *content* field of each table in your database, and you can use a simple sql statement to rip rows from necessary tables.

Search google for fulltext, there are loads of tutorials.

joeiscoolone
06-21-2006, 11:04 AM
Thanks that helped, but what im looking for is more like just a php script that when you submit the query it searches the database and then prints the resultes.

xconspirisist
06-21-2006, 01:06 PM
Well, if you perfect your query in phpmyadmin, then simply execute it like this:



$sql = "MY SEARCH QUERY";

$result = mysql_query($sql);
$result = mysql_fetch_assoc($result);

if ($error = mysql_error()) {
die($error);
}

print_r($result);

cdwhalley.com
06-21-2006, 03:05 PM
I think you would need to get the content out of each table that is specified, and then go through them to count the occurrences of the search term. maybe look for some downloadable search scripts to get some ideas of how they go about things.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum