Re: storing serialized() data in the db -> can it be queried on?

From: Date: Mon, 18 Aug 2003 19:29:40 +0000
Subject: Re: storing serialized() data in the db -> can it be queried on?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-29944@lists.php.net to get a copy of this message
On Mon, Aug 18, 2003 at 09:39:43AM -0400, Matt Babineau wrote: > Hi All- > > I don't think that this is possible but maybe through some custom > function perhaps? I am storing data in a database, and it is an Array > (in PHP) so I serialized it for storage. I want to be able to query that > data and be able to do something like WHERE thisField = 'john'. the > field 'thisField' though would need to be pointing to the first element > in the Array, which I don't think is possible. Has anyone run into this > before? Unless there's a really powerful overriding reason, the best solution is to have a seperate table for the array, with a foreign key that points back to the record in the original table. That will make retrieving data a lot easier; e.g. you can do a query with a join and "WHERE thisField = 'john'". Bob Hall

« previous php.db (#29944) next »