note 29098 added to function.rand
| From: | bakkelun at stud dot ntnu dot no | Date: | Sun, 02 Feb 2003 05:50:44 +0000 |
| Subject: | note 29098 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43283@lists.php.net to get a copy of this message | ||
Well I too having some problems with the
SELECT * FROM TABLE_NAME ORDER BY RAND() LIMIT 1
because, well i have a table which contains path's to uploaded pictures and the corresponding
text to the images, so when people visit the page, and click the "images" link, they can
enjoy a random image picked from the database. Unfortunately I can't get it to randomly show
all the pics, even if I run it a 100 times (!). In fact, it only shows (when refreshed) 3 of the
total 6 pictures. This is weird, and I dunno what's wrong. I would sincerely appreciate any
bright minds out there to help me out. If you want to see what I am talking about..please surf to:
www.moholt-clan.tk and click the link "bilder". It will produce a pop-up window with an
image. In this window there's a "Random"-link which randomly chooses a row from the
picture-information database and puts it to the webpage. If u keep clicking on that link (say 50
times) you'll see what I'm talking about, it only show 3 pictures out of the total 6. (ps:
U'll see that there are 3 pictures that are shown in a in-repitious loop). Another sick thing,
is that if I fix the "LIMIT 1" to "LIMIT 2" then it circles through all the pics
in the database! It's w-e-i-r-d. Well, anyone who can help?
Regards
-Anagram Admin
--
http://www.php.net/manual/en/function.rand.php
http://master.php.net/manage/user-notes.php?action=edit+29098
http://master.php.net/manage/user-notes.php?action=delete+29098
http://master.php.net/manage/user-notes.php?action=reject+29098