This topic is locked
[SOLVED]

 random images

4/19/2010 10:41:15 PM
PHPRunner General questions
M
mdorren author

Hi,

I have a simple table view with BannerID, Image, Link. I only want to disply one record randomly every time the browser refreshes. Here's what I have:
SELECT

BannerID,

Link,

Image

FROM banners

ORDER BY RAND() LIMIT 1
In the result tab of the query page, it works great, but on my list page, I get all the records still.
Any thoughts?
Thanks,

Marty

mikue from germany 4/21/2010

Hi Marty,

  1. Go to Query tab and change sql query to:
    SELECT

    BannerID,

    Link,

    Image,

    RAND() AS RAND()

    FROM banners

    ORDER BY RAND()
  2. Go to Fields tab and uncheck RAND()
  3. Go to Misc tab and change Records per page: 1
    Don't run such a query for a big table with more than 100 rows.
    Kindly regards

    Michael

M
mdorren author 4/22/2010



Hi Marty,

  1. Go to Query tab and change sql query to:
    SELECT

    BannerID,

    Link,

    Image,

    RAND() AS RAND()

    FROM banners

    ORDER BY RAND()
  2. Go to Fields tab and uncheck RAND()
  3. Go to Misc tab and change Records per page: 1
    Don't run such a query for a big table with more than 100 rows.
    Kindly regards

    Michael



Perfect!
Many Thanks!!!