09-09-2009, 11:18 AM
[eluser]hugle[/eluser]
Hello everyone,
for example I'm searching a string from MySQL, for example:
`name` field in mysql is: 'hello everyone here. it's time to code now';
what I want to do, is to get 2 words before and 2 words after match, so the query:
SELECT `id` FROM `name` WHERE `name` LIKE '%here%';
would return me:
'hello everyone here. it's time'
is doable in mysql? or maybe I can do it it with PHP, somehow I can't find any decent example...
Thank you,
Jaroslav
Hello everyone,
for example I'm searching a string from MySQL, for example:
`name` field in mysql is: 'hello everyone here. it's time to code now';
what I want to do, is to get 2 words before and 2 words after match, so the query:
SELECT `id` FROM `name` WHERE `name` LIKE '%here%';
would return me:
'hello everyone here. it's time'
is doable in mysql? or maybe I can do it it with PHP, somehow I can't find any decent example...
Thank you,
Jaroslav