Page 1 of 1

Very Basic Search Engine

Posted: Fri Sep 18, 2009 6:02 pm
by rozkan
Hello, as a beginner i am looking for different applications to study, i need a very basic search engine(?) code basically what i want to see is:

1. A PHP code that creates a database with a bunch of name lets say names are:

Martin Mystere
Zagor
Conan the Barbarian
Frank Frazetta
Dylan Dog

2. And the PHP code to search created database and if possible lets say i wrote "Myst" it would show up "Martin Mystere". I don't think this is such a complicated code but as i said at the beginning i am a beginner. So any help is appreciated, thanks.

Re: Very Basic Search Engine

Posted: Fri Sep 18, 2009 6:11 pm
by SimonMayer
I would recommend using MySQL to store the data, then run a search using the MySQL "LIKE" function.
You can read more about it at http://dev.mysql.com/doc/refman/5.0/en/ ... tions.html

If you are not familiar with MySQL, try the tutorial at Tizag: http://www.tizag.com/mysqlTutorial/

Please reply if you have further questions about using this.

Re: Very Basic Search Engine

Posted: Fri Sep 18, 2009 7:17 pm
by Christopher
rozkan wrote:So any help is appreciated, thanks.
Yes, use the SQL operator "LIKE". You can do queries such as "SELECT * FROM people WHERE name LIKE '%Myst%';" and it will find all matching records. See the PDO section of the PHP manual about accessing the database.