Best Approach for Multiple Options

From: Date: Wed, 03 Sep 2003 10:52:18 +0000
Subject: Best Approach for Multiple Options
Groups: php.general 
Request: Send a blank email to php-general+get-161528@lists.php.net to get a copy of this message
I'm currently in the process of writing a real estate listings program and I am not sure what the best approach is for storing and searching through the property amenities. Example: houses or apartment amenities can be a pool, fitness center, spa, etc. Users must be able to search for listings within a specific price range, location, amenities, or other criteria. I can think of two ways of doing this: The first approach, I can have the facilities table with all available property, a table with all available amenities, and then another table that will serve as an index where I will make use of foreign keys to link property to amenities. The second approach is to store amenities as a text delimited string for each property in the facilities table. So if a certain property has a pool, fireplace and fitness center, I would have 'pool|fireplace|fitness' in the amenities field. I can then use PHP to explode or create an array so that I can manipulate the string. Anybody have any thoughts or advice on this?

« previous php.general (#161528) next »