I tried to make this condition :
if ($Search[1] == '') {
$Where = 'WHERE User.FirstName LIKE '%$Search[0]%' OR User.LastName LIKE '%$Search[0]%';
}else {
$Where = 'WHERE User.FirstName LIKE '%$Search[0]%' OR User.LastName LIKE '%$Search[1]%';
}
but putting ‘%$Search[0]%’ inside PHP variables cause no result. what is the right way to put percentage sign inside PHP variables?
thanks.
You’re using incorrect quoting
% is the modulo operator in PHP. Since you’re using single quotes in your version, you’re actually trying to take the modulo of some SQL text and a variable.