-1
I’m trying to make a code where it only shows the results of a year but so nothing appears.
<?php
$conn = mysqli_connect('localhost','root','','formulario');
$resultado = mysqli_query($conn, "SELECT * FROM dados WHERE data=2019");
$r = mysqli_num_rows($res);
while($r = mysqli_fetch_assoc($res)){
$id=$r['id'];
echo '<tr>';
echo '<td>'.$r['id'].'</td>';
echo '<td>'.$r['data'].'</td>';
echo '<td>' .$r['escola'].'</td>';
echo '<td>'.$r['nome'].'</td>';
echo '<td>'.$r['processo'].'</td>';
echo '<td>'.$r['email'].'</td>';
echo '</tr>';
}
echo '</table>';
?>
What is the table structure in the database? What is the value of
$linhas
? What are the latest messages in your server log file?– Woss
I’ve already modified but still nothing appears, stay blank
– AvicT
Your table does not have a column called
dataenvio
– Woss
yes I’ve changed tmb but it’s the same
– AvicT
And again, what is the value of
$linhas
and what are the latest log messages from your server?– Woss
I’ve already changed the value $lines to $r
– AvicT
Obs.: The column type
data
isdatetimr
, which indicates that it has a date and time. You are only comparing the value with a year.– Woss
If you change to date it will work?
– AvicT
I recommend you read the documentation on the types before and understand what you are doing than go out testing random changes.
– Woss
and where can I find it?
– AvicT
ja resolvi era adicionar like e o ano $resultado = mysqli_query($Conn, "SELECT * FROM dados WHERE datasending LIKE '%2018%'");
– AvicT