What you have should work but can be reduced to:
select * from table where concat_ws(' ',first_name,last_name)
like '%$search_term%';
Can you provide an example name and search term where this doesn’t work?
What you have should work but can be reduced to:
select * from table where concat_ws(' ',first_name,last_name)
like '%$search_term%';
Can you provide an example name and search term where this doesn’t work?