How to use MySQL to search in php serialized fields

Well, first rule – you should not do this. But if there is good reason, consider using such query for searching in index-based arrays:

In case you have assoc array serialized you can use:

Of course it won’t be very fast but in small tables should be enough

5 comments

  1. Using this for a cron job in a table with a serialized field. Works absolutely fine, but should be used as a solution of last resort.

  2. Hi,

    We have to use that second query but it doesn’t return any rows. I want to check array key and array value.

    Advice me.

     

Leave a Reply