So I have an array stored in a database (serialized) with ID's from users.
array1 = serialize(array(1,2,3,4,5));
Let's say we have this like 100 times in the database with different ID's and array sizes (so 100 records)
array2 = serialize(array(6,2,8,1,3,10,12,60));
...
The arrays are stored in a database with the table name items and the row 'lookup'.
table 'items': (id,itemId,lookup)
Now I want to search those serialized arrays that match one ID (for example ID=2). For those that match, I want the itemId.
I could try a SQL query with "like %2%", but that would also match %22% etc. I could select everything and do some foreach() looping in every array, but that sounds very time-comsuming.
Any thoughts, idea's how to do this?