note 102297 deleted from function.rand by danbrown
| From: | danbrown@php.net | Date: | Mon, 07 Feb 2011 15:11:37 +0000 |
| Subject: | note 102297 deleted from function.rand by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176742@lists.php.net to get a copy of this message | ||
Note Submitter: helsouz at gmail dot com
----
Well, i don't know much about php and i try to get my own solutions:
<?php
include('config.php');
$lastid= 'lastid';
$result = mysql_query("SELECT id AS $lastid FROM registered_members ORDER BY id DESC LIMIT
0,1");
while($row = mysql_fetch_array($result))
{
$lastid2= $row[$lastid];}
echo rand(0, $lastid2);
?>
This will get the latest value from ID row, once this is done, the rand($min, $max) will work. Any
inconviniet? Just need to generate random numbers between the 0 and the latest id entry on the
registered_members