Question Detail
How to use MySQL to search in php serialized fields?
How can search data from the serialized column?
Thread Reply
Lokesh Gupta
- 3 years ago
Well, first rule – you should not do this. But if there is good reason, consider using such query for searching in index-based arrays:
SELECT * FROM table WHERE your_field_here REGEXP '.*;s:[0-9]+:"your_value_here".*'
In case you have assoc array serialized you can use:
SELECT * FROM table WHERE your_field_here REGEXP '.*"array_key_here";s:[0-9]+:"your_value_here".*'
Something More