Oon my Search page I've got dropdowns that are linked to an SQL database and pull a list of names (e.g. the combination accent northern-brown-male-manchester brings up A & B, southern-grey-female-london brings up X & Y)
This works fine. What I'm trying to do is add an if statement so if no rows are returned, I get a default message of
"No actors match your criteria, please try again"
The problem is, I always get the default message, even when records are being returned
Is it a bracket problem?....It's always a bracket problem!
This works fine. What I'm trying to do is add an if statement so if no rows are returned, I get a default message of
"No actors match your criteria, please try again"
The problem is, I always get the default message, even when records are being returned
PHP:
if ($result->num_rows > 0){
echo '<table><tr><th>id</th><th>name</th></tr>';
while($row=$result->fetch()) {
echo '<tr><td>'.$row['id'].'</td><td>'.$row['name'].'</td></tr>';
}
echo '</table>';
}
else
{
echo '<p> No actors match your criteria, please try again </p>';
}
Is it a bracket problem?....It's always a bracket problem!