Re: mySQL searching through serialized arrays

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

 



On Tuesday 07 September 2004 12:14, rolando g wrote:
> I am storing array of user IDs as TEXT using the serialize() function
> on the array, since several users, one or none can be part of each
> record...
>
> and I noticed that the serialized array has the values in double
> quotes  like :"21";  for example... so since I know that the values
> will be enclosed,  i am using the sql statement, with 21 as the
> example variable:
>
> SELECT FROM table WHERE userarray LIKE '%\"21\"%'
>
> is there a better way or a built-in mySQL function to filter through
> the serialized array

You're not using the database properly. Have a separate table where each 
record contains a user_id and the record_id to which it is linked.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
T-shirt:
	Life is *not* a Cabaret, and stop calling me chum!
*/

-- 
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