I have a table containing lots of data and one of them is a blob. I some times needs to look into this blob for data using PHP.
I do:
select `desc` f
This query:
SELECT
CONCAT(
'...',
SUBSTR(`description`,
LOCATE('Nam rhoncus', `description`) - 10,
(LENGTH('Nam rhoncus') + 20)),
'...') AS `description`
FROM table
WHERE `description` LIKE '%Nam rhoncus%';
(I broke it down like this so it's easier to read)
this will output:
...m auctor. Nam rhoncus, purus eg...
So in your PHP you can do:
NOTE: Ill be careful using mysql reversed words, this is why I use description instead.