First of all, follow Redcircle's advice.
jctgonzalez said:
Code:
$query .= "first LIKE '%.$first.%' AND ";
Now then, my question is this: are those dots supposed to be there? If we set $first to "Jordan", the above will be evaulated to:
Code:
first LIKE '%.Jordan.%' AND
Unless all of the first names (and most of the other fields, apparently), actually have dots on either side in your database, and I can't think of why that might be, it seems to me that this is amiss. My guess is that you got yourself confused and decided to try to use concatenation dots within the string. You probably want this instead:
Code:
$query .= 'first LIKE \'%' . $first. '%\' AND ';
Or, if you insist on making PHP parse variables inside strings, like this:
Code:
$query .= "first LIKE '%$first%' AND ";
Let me know if that helps.
(As a matter of trivia, though the second one looks simpler than the first, it causes PHP to do some additional processing and also makes your code harder to read.)