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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux