niche Posted September 16, 2011 Share Posted September 16, 2011 This script is based on the creation of a column that's repopulated each time the script runs. It would be great to randomly re-order just the mysql resource from the query. Is that even possible? Here's my script: require_once "connect_to_mysql.php";mysql_query("UPDATE preplan set random_num = RAND()") or die(mysql_error());require_once "connect_to_mysql.php";$act_directs = mysql_query("SELECT * FROM preplan WHERE TIMESTAMP(NOW()) BETWEEN TIMESTAMP(begin) AND TIMESTAMP(end) ORDER BY random_num ASC") or die(mysql_error());$act_directs2 = mysql_fetch_array($act_directs);$id = $act_directs2['id'];echo $id; Link to comment Share on other sites More sharing options...
JamesB Posted September 16, 2011 Share Posted September 16, 2011 maybe you could do: ORDER BY RAND() ASC Link to comment Share on other sites More sharing options...
niche Posted September 17, 2011 Author Share Posted September 17, 2011 I like that! You made that simple. Thanks James B. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.