note 60145 added to function.rand
| From: | php-general at lists dot php dot net | Date: | Tue, 27 Dec 2005 23:03:50 +0000 |
| Subject: | note 60145 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-100824@lists.php.net to get a copy of this message | ||
I need to have the same "random" records for one week.
$strSql="select min(id) as min, max(id)as max from table";
$row = mysql_fetch_array(send_sql($strSql),MYSQL_BOTH);
$min=$row["min"];
$max=$row["max"];
srand(date("W")); // < This sets a new starting point every week
for ($i=1;$i<10;$i++){
$where.=" id = ".rand($min,$max)." or ";}
....
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60145
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60145&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60145&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60145&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60145&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60145&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60145&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60145&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60145&report=yes
Search -- http://master.php.net/manage/user-notes.php