From: Tony L. <la...@is...> - 2003-01-01 17:24:48
|
In an ancient thread of only two messages (http://www.geocrawler.com/mail/msg.php3?msg_id=6328035&list=4037) Reini said: "how to workaround this mysql 3.23 feature which doesn't work in 3.22? select pagename from wiki order by rand() limit 1; the rand() function is defined in 3.22 also, but I wanted to avoid subselects. attempt 1: $res = mysql_query("select pagename from $WikiPageStore", $dbi["dbc"]); srand((double)microtime()*1000000); $rows = mysql_num_rows($res); $page = mysql_result($res,rand(0,$rows-1)); how can one avoid to checkout all pages by using mysql the rand() function? LIMIT doesn't accept ROUND($pagecount*rand()),1 as argument. mysql v3.22.25 doesn't accept this syntax neither: set @i:=round(200*rand());" I am having to deal with this problem now, unfortunately. At the moment, I am trying to get something on PostNuke to work, but this will also be an issue is I try to do something like Reini describes with the phpWiki module, as I must work with 3.22 at this time. Here are my notes at this time: http://www.issho.org/modules.php?op=modload&name=phpWiki&file=index&pagename=RandomHeadlinesTalk Please let me know if the phpWiki found a proper workaround, or has an idea for one at this time. RandomPages would be great! -- Tony Laszlo http://www.issho.org/laszlo.html |