User will input/output some fields and exclude some fields. We want php- SQL query so that it should search in database for only inputted textfield values and display output.
Please try like the following so this can help you from the search string
$query = array();
$query[] = empty($_POST['name']) ? : 'name='.$_POST['name'];
$query[] = empty($address) ? : 'address'.$_POST['address'];
$results = implode('AND', $query);
$test = "SELECT * FROM tableName where '".$results."'";