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".*'
Of course it won’t be very fast but in small tables should be enough
Man, the solution is great!
Brillant! Very handy ineed!
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.
Hope this helps about searching a serialized string from mysql:
http://www.namasteui.com/search-from-serialize-field-in-mysql-database/
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.
Save My Time …Thanks