mySQL searching through serialized arrays
| From: | rolando g | Date: | Tue, 07 Sep 2004 04:14:53 +0000 |
| Subject: | mySQL searching through serialized arrays | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-36084@lists.php.net to get a copy of this message | ||
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