Hello i have a simple search query, what i'm facing is when someone writes the only first name of the user that he wants to search, my query finds it, also when someone only writes the last name in the input and posts it, it also shows that too, but when user writes first name and last name together in the input, it can't find the user even he/she exists. The last part of $q query where i wrote first name and last name like part doesnt work i know there my logic is bad, but how can i fix that
try {
$q = "SELECT * FROM `members` WHERE `first_name` LIKE :search_string OR `last_name` LIKE :search_string OR `first_name` AND `last_name` LIKE :search_string";
$q_do = $db->prepare($q);
$q_do->execute( array("search_string"=>'%'.$query.'%') );
$number = $db->query("SELECT FOUND_ROWS()")->fetchColumn();
} catch(PDOException $e) {
$log->logError($e." - ".basename(__FILE__));
}
Thank you