[Solved] Search function not working in php


If you are looking to search, you need to use the LIKE syntax, not WHERE

$sql="SELECT  * FROM members WHERE FirstName LIKE '". $fname ."%'";

The LIKE & % make it a wildcard. Now you said you want to search by first and last, but you only pass in your first variable and you only query the first field, so you will need to pass the last name as well and add an OR to the SQL and encapsulate the firstname like or lastname like in parenthesis for better performance if you expand the sql later..

$sql="SELECT  * FROM members WHERE (FirstName LIKE '". $fname ."%' OR LastName LIKE '". $lname ."%')";

2

solved Search function not working in php