Re: Best Approach for Multiple Options

From: Date: Wed, 03 Sep 2003 10:34:04 +0000
Subject: Re: Best Approach for Multiple Options
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-161530@lists.php.net to get a copy of this message
Ralph Guzman wrote:
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?
my first thought is that it's not necessary to explode with PHP. this will return true for something like 'pool|fireplace|fitness' mysql_query('select id from theTable where amenities like "%pool%"') you could make it more efficient by using boolean logic: if 1=pool,2=fireplace,4=fitness, then 3=fireplace+pool, 5=fitness+pool, 7=fitness+fireplace+pool just thoughts. Kae

« previous php.general (#161530) next »