RE: Random record from latest 10 entries...

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

 



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

         It can be done in two steps. First:

SELECT COUNT(*) FROM TableName

In PHP generate a random number $Random between 0 and $Count - 1.
SELECT .......
    LIMIT $Random,1

         For this specific problem random number between $Count -11 
and $Count-1

SELECT .....
    ORDER BY $CreationDate
     LIMIT $Random,1

Urb



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

  Powered by Linux