Orionsbelter Posted May 3, 2009 Share Posted May 3, 2009 hi am trying to get an mysql array of some users, i want to randomly select 4 users that are online so i have done the following. mysql_fetch_object(mysql_query("SELECT username FROM users WHERE online > $timenow ")); now i want to put all the usersnames into an array and the randomly pick four, anyone know how i would go about that please? Link to comment https://forums.phpfreaks.com/topic/156646-mysql-array-help-please/ Share on other sites More sharing options...
Daniel0 Posted May 3, 2009 Share Posted May 3, 2009 Use MySQL for that instead. See this topic: http://www.phpfreaks.com/forums/index.php/topic,125759.0.html Link to comment https://forums.phpfreaks.com/topic/156646-mysql-array-help-please/#findComment-824818 Share on other sites More sharing options...
the182guy Posted May 3, 2009 Share Posted May 3, 2009 SELECT username FROM users WHERE online > $timenow ORDER BY RAND() LIMIT 4 That will pick 4 random users from the database, as long as there is 4 online Link to comment https://forums.phpfreaks.com/topic/156646-mysql-array-help-please/#findComment-824845 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.