I came across the following in some old PHP code that I have to work on. My question is, are both those Ifs required? In other words, if a result is returned it must have returned greater than zero records, right? And the converse - meaning if $result is False, can I assume that no records have been found?
$sql = "SELECT * FROM houses WHERE ownerphone=$pn";
$result = $conn->query($sql);
if ($result) {
$count = $result->num_rows;
if ($count > 0){
....Stuff happens here...
} else {
...What happens here?...
}
} else {
...Other Stuff happens here
}