Everah wrote:Use isset() or empty() to check, don't just throw them into a conditional.
As Everah has stated, you need to verify that these variables are set before you run comparisons on them. If you run comparisons on them without them being set, PHP will issue warnings.
Wouldn't this do the trick? It works fine when searchQuery equals nothing too. But when it equals " "(spaces) it just doesn't display results(which is fine).
<?php
if ($yellowmustard && $purpledentistgloves) {
// execute
}
?>
If those vars are not defined (null) and PHP attempts to compare them as booleans, well, the PHP engine doesn't like trying to find the value of non-existent variables, do it squaks. You might not see because of the display_errors setting or error_reporting setting, but they are there, and they are having an impact on your script performance.