Calling some part only with $key

I think what you are trying to do is grab the characters before and after a search character. In the word ‘happy’, you want to grab ‘ha’ and ‘py’ if your search term is ‘p’ right?

If so, I think perhaps you want to take a look at the function SUBSTRING_INDEX which can be used for this purpose.

Do know that “string” in this function can be your content field.

1 Like