I would like to retrieve 10 random rows from my database, each time i refresh the page i want the random rows to change.
I have made a query and a while loop to output all 10 results however i am just getting a blank page in return, there is no errors, nothing....
Its probably something silly i have missed out, but i just cant find it.
Here is my PHP :
<?php
include '../dbconnect.php';
$res = $conn->query("SELECT id FROM messages ORDER BY RAND() LIMIT 10");
while($row=$res->fetch_array())
{
echo $row['id'] . "<br>";
}
?>
Thankyou for any help
Aucun commentaire:
Enregistrer un commentaire