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 or is count() = 0
the following error appears:
Notice: Undefined variable: total in D: \ xampp \ htdocs \ wareemdahouse \ publication.php on line 164 Sorry, no content was found for your search! Please try again ...
How do I fix it?