If I have to loop results of a query echoing first all fields of a column, then echoing something not to loop, then fields of another column. So I'm using
<?php
$con = mysqli_connect();
echo 'Latest users who tried our test<br>';
//select the fields of the first column
$query1 = mysqli_query($con,"SELECT user FROM ris_uinversita LIMIT 0,10");
//loop the results
while($assoc1=mysqli_fetch_assoc($query1)){echo $assoc1['user'].'<br>';}
//echo something not to loop
echo 'Users got the following scores<br>';
//select the fields of the second column
$query2 = mysqli_query($con,"SELECT score FROM ris_universita LIMIT 0,10");
//loop the results
while($assoc2=mysqli_fetch_assoc($query2)){echo $assoc2['score'].'<br>';}
?>
Is it possible to use just one query like this
mysqli_query($con,"SELECT * FROM ris_universita LIMIT 0,10");
Toto select both fields just once? If
If it could be helpful, table "ris_universita"ris_universita has just the two columns: "score" (tinyinttinyint) and "user" (varchar 30varchar 30), for now there. There aren't so many records for now, but I hope in future there will be in the future.