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?
More Related Contents:
- How to update multiple MySQL table entries with different id?
- Can’t insert data into mysql database using PHP [closed]
- which is better every user have a table or just a row [closed]
- How can I use PDO to fetch a results array in PHP?
- Fixing broken UTF-8 encoding
- MySQL check if a table exists without throwing an exception
- Export MySQL data to Excel in PHP
- MySQL – ignore insert error: duplicate entry
- Calculate age based on date of birth
- How to write a stored procedure using phpmyadmin and how to use it through php?
- “slash before every quote” problem [duplicate]
- Doing calculations in MySQL vs PHP
- Geo-Search (Distance) in PHP/MySQL (Performance)
- Call to a member function execute() on boolean in [duplicate]
- PHP mysql search multiple tables using a keyword
- SQLSTATE[HY000] [1045] Access denied for user ‘username’@’localhost’ using CakePHP
- How to store the data in unicode in hindi language
- PDO + MySQL and broken UTF-8 encoding
- Best practice: Import mySQL file in PHP; split queries
- Connecting to remote MySQL server using PHP
- Using PHP to execute multiple MYSQL Queries
- Base table or view not found: 1146 Table Laravel 5
- How would I implement a simple site search with php and mySQL?
- Check for duplicates before inserting
- How to run multiple insert query in SQL using PHP in one go?
- mysqli_affected_rows in PHP insert
- PHP MySQL set Connection Timeout
- Sort by date (newest)
- The ultimate emoji encoding scheme
- mysql count occurrences of special character in a field