Your daily news about web technology, interface and design.

Sorry about the current website getting messy,
we are currently moving to our new wordpress platform "webmasterbulletin.net".
> Developper's Zone > mysql magic
 
mysql random records

It's very easy to get random records from a mysql table using the special rand function in the order clause !

Intended audience : Developpers / Beginner

The rand function combined with the limit argument is the best way to write a mysql query that returns a sample set of  random rows from a table :

mysql> SELECT * FROM tbl_name ORDER BY RAND();


This is described in the mysql manual and is ok on most mysql servers as long as they're version 3.23 and superior.



Comments are temporarily disabled because of SPAM


Most read :
  • php move file (50971 readers).
  • Excel : export to a text file with a chosen delimiter (49177 readers).
  • Replace string in file with sed (34910 readers).
  • Oracle autoincrement columns (26684 readers).
  • mysql replace string in a query (22743 readers).
  • String replace (21877 readers).
  • Shell : rename all files in subdirectories to lower-case (21517 readers).
  • Flash Page turn effect : goto PAGEFLIP (20144 readers).
  • Read Excel Spreadsheet with PHP (19902 readers).
  • Tip : get yesterday's date (19259 readers).

  • download webxadmin
      Support webxadmin !
    donate
    Donators get sitescope OS
      > About webxadmin
    > Site map
    > Contact the author :
    webxadmin at free dot fr

    Pôle Ouest - web design services and opensource consultancy - Quimper Brest Lorient Douarnenez Carhaix
    Google

    Pôle Ouest - web design services and opensource consultancy - Quimper Brest Lorient Douarnenez Carhaix

    Excel2Mysql converts Excel sheets to Mysql insert queries

    Flash Photos Viewer : Eyelash

     Use OpenOffice.org



    Free Software and Game Downloads