Page 1 of 1

create a search engine

Posted: Wed Mar 25, 2009 10:00 am
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

Re: create a search engine

Posted: Wed Mar 25, 2009 10:04 am
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

Re: create a search engine

Posted: Wed Mar 25, 2009 10:08 am
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?

Re: create a search engine

Posted: Wed Mar 25, 2009 10:21 am
by onion2k
Just use LIKE, or MATCH...AGAINST with a full text index. There's no need to write the engine yourself.

Re: create a search engine

Posted: Wed Mar 25, 2009 10:24 am
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

Re: create a search engine

Posted: Wed Mar 25, 2009 10:25 am
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
 

Re: create a search engine

Posted: Wed Mar 25, 2009 10:36 am
by sebis
thank you guys for the help. I will work on it now.