-3
I have a code that checks how many records an sql query returns.
<?php
if ($results) { $total = count($results); }
if ($total > 0) {
echo "<p>Encontramos " .count($results). " conteúdo(s) para a sua busca!</p>";
} else {
echo "<p>Lamentamos mas nenhum conteúdo foi encontrado para a sua busca! Tente novamente...</p>";
}
?>
When you find 1 or more records the message to the user appears right. When nothing is found count() = 0
appears the following error:
Notice: Undefined variable: total in D: xampp htdocs armazemdahouse Publication.php on line 164 We are sorry but no content has been found for your search! Try again...
How do I solve?
What code is on the line
164
ofpublication.php
?. And how is the$results
?– Isac
@Isac line 164 is if ($total > 0) {
– Flávio Kowalske