Use part of the variable in mysql query?

I think this topic is closed :slight_smile:
solution is below