View Full Version : PHP Search Engine

06-21-2006, 03: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.

06-21-2006, 03: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.

06-21-2006, 10: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.

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


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

if ($error = mysql_error()) {


06-21-2006, 02: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.