I'm trying to make a simple if else statement but I cannot get the desired results and am obviously using the wrong methods.
This is what I have:
if (!$res7 and !$res8) {output one - this should appear if both $res7 and $res8 are empty}
else if (!$res8) {output two - this should appear if $res8 is empty}
else if (!$res7) {output three - this should appear if $res7 is empty}
The outputs show what I desire, can someone help with fixing it? Thanks
EDIT the full code: $res7 and $res8 are results from a MySQL query
$res8 = $pdo->query($query8);
if (empty($res7) && empty($res8)) {
printf("We currently have no reviews for this park or its attractions. If you have been to %s please take a minute to give your feedback. You don't need to register to leave reviews or ratings. Thank you." . PHP_EOL, $row[name]);
}
elseif (empty($res8)) {
printf("We currently have no attraction reviews for this park. If you have been to %s please take a minute to give your feedback. You don't need to register to leave reviews or ratings. Thank you." . PHP_EOL, $row[name]);
}
elseif (empty($res7)) {
printf("<h3>Park Review</h3>We currently have no reviews for this park as a whole. If you have been to %s please take a minute to give your feedback. You don't need to register to leave reviews or ratings. Thank you." . PHP_EOL, $row[name]);
}
else {
printf("all good");
}