Very Basic 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
rozkan
Forum Newbie
Posts: 10
Joined: Thu Jul 02, 2009 8:08 pm

Very Basic Search Engine

Post 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.
SimonMayer
Forum Commoner
Posts: 32
Joined: Wed Sep 09, 2009 6:40 pm

Re: Very Basic Search Engine

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Very Basic Search Engine

Post 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.
(#10850)
Post Reply