Hello Everyone!
I am working on a search form in PHP for a client's website. So everything works, the search brings results. What I am wanting to accomplish now is to be able to search more than one field, specifically first name and last name. Let's say if a user inputs let's say a first name AND a last name into the search input field and then searches, I want it to display results based on that. Right now if you try it, it says there are no results. My thought is how I've coded it is for the search box to be able to search only in ONE column field for per row.
Here is that part of my code:
// QUERY THE DATABASE TABLE
$sql="SELECT * FROM contracts
WHERE Status LIKE '%" . $searchTermDB . "%'
OR DealerName LIKE '%" . $searchTermDB ."%'
OR Dealer LIKE '%" . $searchTermDB ."%'
OR Contract LIKE '%" . $searchTermDB ."%'
OR LastName LIKE '%" . $searchTermDB ."%'
OR FirstName LIKE '%" . $searchTermDB ."%'
OR EffDate LIKE '%" . $searchTermDB ."%'
OR TermDate LIKE '%" . $searchTermDB ."%'
OR Year LIKE '%" . $searchTermDB ."%'
OR Make LIKE '%" . $searchTermDB ."%'
OR Model LIKE '%" . $searchTermDB ."%'
OR Serial LIKE '%" . $searchTermDB ."%'
OR TermMeter LIKE '%" . $searchTermDB ."%'
OR Plan LIKE '%" . $searchTermDB ."%'";
Let me know of any suggestions. Thanks!