Setting up a site 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
chris12295
Forum Contributor
Posts: 113
Joined: Sun Jun 09, 2002 10:28 pm
Location: USA
Contact:

Setting up a site search engine

Post by chris12295 »

I have a website where people can buy ads, kind of an online classifieds. What are the steps i should take to set up a site search engine so users can submit ads and search them using keywords?
User avatar
fatal
Forum Contributor
Posts: 118
Joined: Sat Apr 20, 2002 10:47 am
Location: East Coast

Post by fatal »

if you store the ads in MySQL you van easly search the database, using the "LIKE" command in your querys.
chris12295
Forum Contributor
Posts: 113
Joined: Sun Jun 09, 2002 10:28 pm
Location: USA
Contact:

that was fast

Post by chris12295 »

how exactly would i go about setting up the database to allow people to add the ads? and how would i retrieve them using "LIKE" in my query, im new to php and MySQL.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

It's probably best if you start with a tutorial. Try, The manuals are also an excellent resource once you understand the basics: Mac
Peter
Forum Commoner
Posts: 28
Joined: Mon Jun 10, 2002 12:40 am
Location: Brisbane, Australia

Post by Peter »

An example of a like query would be:

SELECT ads FROM table WHERE keywords LIKE "search parameters" ORDER BY date, name
MattF
Forum Contributor
Posts: 225
Joined: Sun May 19, 2002 9:58 am
Location: Sussex, UK

Post by MattF »

if you want wild cards you can do:

LIKE %word%
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

but be aware that queries with a % at the beginning of a search string (select * from tablename where fieldname like '%searchtext%') take a lot longer to search for as the database has to look at every record.

Mike
Post Reply