I'm trying to do a MySQL query where I extract the search string in context. So if the search is "mysql" I'd like to return something like this from the 'body' column
"It only takes minutes from downloading the MySQL Installer to having a ready to use"
This is what I've got now but it doesn't work because it just grabs the first 20 characters from the body field. While I'd like it to grab 20 chars in front of and behind the searched term so that the user can see what there term looks like in context:
SELECT id, title, substring(body, 0, 20) FROM content WHERE body LIKE '%mysql%' OR title LIKE '%mysql%';
Thanks