SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    will code HTML for food Michel V's Avatar
    Join Date
    Sep 2000
    Location
    Corsica
    Posts
    552
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, i got some links' lists, but i'm tired to see them standing static on the pages.

    Is there a way in PHP that i can have the links displayed in random order ?

    (I first thougt about modifying a "random quote" script but i had sometimes duplicated links as a result...)
    [blogger: zengun] [blogware contributor: wordpress]

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Helsingborg, Sweden
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you have the links in an array you can use the function shuffle() that randomizes the order of the elements in an array.
    "Some people play hard to get - I play hard to want."

  3. #3
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you're fetching them from MySQL, let MySQL do the shuffling for you:

    http://www.sitepointforums.com/showt...4501#post34501
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •