Thread: Foreign Key for PHP serialized data - possible?

Foreign Key for PHP serialized data - possible?

From
"Dave"
Date:
Hi,

I have a table1 with a tb1_column that stores PHP serialized data that are
unique integers.
| tb1_column |
-----------
a:5:{i:0;s:1:"9";i:1;s:2:"5";i:2;s:2:"11";i:3;s:2:"100";i:4;s:2:"10";}

I also have a table2 with unique integers (ids) in tb2_column
| tb2_column | descr |
----------
11 | Pears
100 | Plums
9 | Apples
5 | Oranges
10 | Cranberries

What I'm trying to do is to create a foreign key on tb1_column so that if a
number in tb2_column changes or gets deleted, it cascades to the appropriate
segment of the serialized data.
e.g. if an id of Oranges changes from '5' to '24', the  tb1_column rows will
get changed in the above example row to:
a:5:{i:0;s:1:"9";i:1;s:2:"24";i:2;s:2:"11";i:3;s:2:"100";i:4;s:2:"10";}

Is this possible? Can anyone suggest a function that would do that?

If not what is the alternative that will have a similar effect?

Thanks

Dave