1
I’m requesting the table data this way:
$sql = "SELECT * FROM `login` order by `userid` DESC";
$limite = mysqli_query($db, $sql);
while ($sql = mysqli_fetch_array($limite)) {
$account_id = $sql['account_id'];
$userid = $sql['userid'];
$sex = $sql['sex'];
$email = $sql['email'];
$group_id = $sql['group_id'];
$last_ip = $sql['last_ip'];
}
echo '
<table class="vertical-table th">
<tr align="center">
<th width="10%">
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="2"><b>ID</b></font></th>
<th width="10%">
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="2"><b>Login</b></font></th>
<th width="25%">
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="2"><b>Sexo</b></font></th>
<th width="10%">
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="2"><b>Email</b></font></th>
<th width="25%">
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="2"><b>Level</b></font></th>
<th width="20%">
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="2"><b>IP</b></font></th>
</tr>
<tr align="center">
<td>
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" color="#009900" size="2">'.$account_id.'</font></p></td>
<td>
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="2"><b>'.$userid.'</b></font></p></td>
<td>
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="2">'.$sex.'</font></p></td>
<td>
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" size="2">'.$email.'</font></p></td>
<td>
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" color="#E41B17" size="2">'.$group_id.'</font></p></td>
<td>
<p style="margin-top: 0; margin-bottom: 0"><font face="Verdana" color="#000099" size="2">'.$last_ip.'</font></p></td>
</tr>
</table>
Testing the query directly in the database works perfectly, but the page only returns the first line...
I didn’t understand the difference, I could illustrate a little better?
– GGirotto
@Guilherme responding in a very practical way, you can find great examples in this documentation: http://php.net/manual/en/tutorial.php If you can not find here: http://learnphp.com.br/. Even so I know it’s a little advanced documentation but I think you’ll be able to understand how a While works
– Otto
Perfect! Now I understand xD Thank you so much for the reply!
– GGirotto
@William, his
echo
that prints the table is outside thewhile
that is to say it will run only once different from the commands within the while that will run several times.– rray