I need to check if my 'Select', is returning records to then load the data on the screen. Here is the code I'm using:
$sql = mysqli_query($conn,"SELECT * FROM USUARIOS;");
$linhas=mysqli_num_rows($sql);
//eu preciso verificar aqui!!!!!
while ($linhas = mysqli_fetch_array($sql, MYSQLI_ASSOC)) {
echo "<td hidden='true'>". $linhas['id'] ."</td>";
echo "<td>". $linhas['nome'] ."</td>";
}
Based on the code above how should I check if the query returned records?
Because if you have not returned, I will display a message on the screen, "There is no registration yet."
The goal is: When you have no records, you do not return any errors.
Note: when you have registered data it runs perfectly