Enum database search

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
LizzyD
Forum Newbie
Posts: 22
Joined: Mon Oct 04, 2004 5:36 am

Enum database search

Post by LizzyD »

hi there!

I hope someone can help me... I have a hotel database with over 100 field headings and 3000 rows.

The field headings are all facilities such as tennis, creche, restaurant etc...

The values under each heading for all 3000 hotels are either Y or N, indicating whether or not a specific hotel has each specific facility.

I want to put a search box on my site using this information, where a user can type one or more keywords, eg. tennis, creche, golf and get a list of hotels which matches.

But i can't work out how to do it!! I've been searching all the forums but no luck. I'd be grateful if anyone could point me in the right direction! Thanks very much!

LizzyD

(P.S Some headings say stuff like "Iron / Ironing Board" - I'd also like, if possible for the search to work if someone enters Iron, or if they enter Ironing Board - is this possible??)
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

I would personally change this database so that each hotel simply held one field for what services it offered and let that field hold a list of id numbers that links to the facility.

At the moment it will be hard for you to search as you have to search through a hundred fields, whereas if you changed your database you would simply have to search the facilty table to get the ID's of the specified services and then check to see if that ID is present in the second table.
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post by Draco_03 »

keetle_drum wrote:I would personally change this database so that each hotel simply held one field for what services it offered and let that field hold a list of id numbers that links to the facility.
I concur

You should read about database designing (google is your friend)
I'm assuming that you did the design here.
LizzyD
Forum Newbie
Posts: 22
Joined: Mon Oct 04, 2004 5:36 am

Post by LizzyD »

Thanks very much - I'll think about it - sounds like a lot of work!! cheers for your replies though - much appreciated!

LizzyD
Post Reply