create a search engine

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sebis
Forum Newbie
Posts: 6
Joined: Thu Mar 19, 2009 7:28 am

create a search engine

Post by sebis »

hello all.
I have just started working with php language and am doing a website for french history. I would like to make a search engine where someone writes a word inside and then the program looks in a table in mysql and returns the results. For example if someone writes eiffel tower in the search the result will be a new page with the history of the eiffel tower.I know how to work in mysql and how to connect the php with mysql.What am asking is if someone knows a site with tutorials about search engines or something.Any help will be appreciated
Thank you
Darkzaelus
Forum Commoner
Posts: 94
Joined: Tue Sep 09, 2008 7:02 am

Re: create a search engine

Post by Darkzaelus »

How long do you have for this?

Search engines are very advanced applications, not what you need when starting the language.

Cheers,

Darkzaelus
sebis
Forum Newbie
Posts: 6
Joined: Thu Mar 19, 2009 7:28 am

Re: create a search engine

Post by sebis »

well my project is due untill 15 of may. But i am willing to spend hours to learn it i have much time to spend on it.Any suggestions?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: create a search engine

Post by onion2k »

Just use LIKE, or MATCH...AGAINST with a full text index. There's no need to write the engine yourself.
baross
Forum Newbie
Posts: 3
Joined: Wed Mar 25, 2009 9:41 am

Re: create a search engine

Post by baross »

onion2k wrote:Just use LIKE, or MATCH...AGAINST with a full text index. There's no need to write the engine yourself.
these are SQL commands.
Heres a tutorial :
http://www.designplace.org/scripts.php?page=1&c_id=25
Flamie
Forum Contributor
Posts: 166
Joined: Mon Mar 01, 2004 3:19 pm

Re: create a search engine

Post by Flamie »

Just read on the following functions:

http://www.php.net/mysql_connect
http://www.php.net/mysql_select_db
http://www.php.net/mysql_query
http://www.php.net/mysql_fetch_assoc or mysql_fetch_object or mysql_fetch_row

Once you have connected to the database you can write a query like:

Code: Select all

 
$search_string = "effeil tower"; //or whatever the user entered
$str_query = "SELECT * FROM `table_you_want_to_query` WHERE `field_you_want_to_search` LIKE '%".$search_string."%'";
$result = mysql_query($str_query);
//process result here
 
sebis
Forum Newbie
Posts: 6
Joined: Thu Mar 19, 2009 7:28 am

Re: create a search engine

Post by sebis »

thank you guys for the help. I will work on it now.
Post Reply