Re: Random record from latest 10 entries...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i went for 
 
$rnd_num = rand(0,9); 
 $get_rnd_pic = "SELECT * FROM my_table ORDER BY id DESC LIMIT ". $rnd_num.",1"; 

Thanks

Anees Muhammed
___________


----- Original Message ----
From: "Atkinson, Robert" <ratkinson@xxxxxxxxxxxxx>
To: php-objects@xxxxxxxxxxxxxxx
Sent: Wednesday, November 21, 2007 6:29:06 PM
Subject: RE:  Random record from latest 10 entries...










  


    
            SQL does not have a 'random' keyword that I know of.



The best you can do is load the latest 10 entries into an array, and then

pick one of the array entries using the mt_rand() function.



Rob. 











      ____________________________________________________________________________________
Be a better pen pal. 
Text or chat with friends inside Yahoo! Mail. See how.  http://overview.mail.yahoo.com/

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux