ambo Posted January 28, 2009 Share Posted January 28, 2009 I have a code that calls active users and displays them i was wondering if there was a way to bake the row displayed random <? if(!defined('TBL_ACTIVE_USERS')) { die("Error processing page"); } $q = "SELECT username FROM ".TBL_ACTIVE_USERS ." ORDER BY timestamp DESC,username"; $result = $database->query($q); /* Error occurred, return given name by default */ $num_rows = mysql_numrows($result); if(!$result || ($num_rows < 0)){ echo "Error displaying info"; } else if($num_rows > 0){ /* Display active users, with link to their info */ echo "<table align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; echo "<tr><td><font size=\"2\">\n"; for($i=0; $i<$num_rows; $i++){ $uname = mysql_result($result,$i,"username"); echo " <div align=\"center\"><a href=\"profile.php?user=$uname\">" ."<img src=\"../image.php?id=$session->username\" width=\"50\" height=\"50\" border=\"0\"/></a><br>" ."<a href=\"profile.php?user=$uname\">$uname</a></div>"; } echo "</font></td></tr></table><br>\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/142729-random-order/ Share on other sites More sharing options...
xtopolis Posted January 28, 2009 Share Posted January 28, 2009 There are many ways, this MYSQL one being one of them: http://www.phpfreaks.com/forums/index.php/topic,125759.0.html Link to comment https://forums.phpfreaks.com/topic/142729-random-order/#findComment-748196 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.