i have been messing around with a search engine and i am trying to get the while statement to run and echo the results in a random order. Here is the code i have now.
if ($numrows > 0) {
while ($row = mysql_fetch_assoc($query)) {
$id = $row['id'];
$title = $row['title'];
$description = $row['description'];
$keywords = $row['keywords'];
$link = $row['link'];
echo "<div id='resultbox'><h3><a href='$link'>$title</a></h3><br><p>$description</p></div>";
}
I need the while statement in theory to run and display results completely randomly.
Is there anyway this can be done?
Thanks!
You can do
order by rand()in your query to order the results randomly.