You are here: DEVPPL Forum Programming PHP and MySQL Forum
NOTIFICATIONS
54.067
MEMBERS
15.678
TOPICS
62.243
POSTS
  562
FLASH GAMES
7.740
TUTORIALS
 

Login

E-mail:
Password:

ORDER BY "random?" from MySQL

0

Loading

ORDER BY "random?" from MySQL

Postby Ebba » Sun Sep 05, 2004 12:26 pm

When I list things from a MySQL database I can order by different things, but how can I do to just show random posts from the database?
Ebba
 
Reputation: 0
Posts: 25
Joined: Mon Aug 16, 2004 8:37 pm
Highscores: 0
Arcade winning challenges: 0

ORDER BY "random?" from MySQL - Sponsored results

Sponsored results

Login to get rid of ads

 

0

Loading

Postby Rasmus Lindström » Sun Sep 05, 2004 3:10 pm

You are pretty close to the answer, you should use ORDER BY RAND()
[url=http://www.linkedin.com/profile/view?id=96243938]Meet me on LinkedIn[/url]
[img]http://www.devppl.com/images/facebook_icon_small.jpg[/img] Help DEVPPL grow, [url=http://www.facebook.com/pages/DEVPPL/140524279390050]like DEVPPL on facebook[/url]!
Rasmus Lindström
Site Admin
 
Reputation: 18
Posts: 2829
Joined: Tue Aug 17, 2004 2:07 pm
Location: Sweden
Highscores: 1
Arcade winning challenges: 0
0

Loading

Postby Ebba » Sun Sep 05, 2004 5:03 pm

It worked, thanks =)
Ebba
 
Reputation: 0
Posts: 25
Joined: Mon Aug 16, 2004 8:37 pm
Highscores: 0
Arcade winning challenges: 0
0

Loading

Postby Fruitcake » Tue Sep 07, 2004 3:08 pm

Does that ensure that the same row isn't picked more than once?
Fruitcake
 
Reputation: 0
Posts: 30
Joined: Sun Sep 05, 2004 9:15 am
Location: Perth, Australia
Highscores: 0
Arcade winning challenges: 0
0

Loading

Postby Rasmus Lindström » Tue Sep 07, 2004 4:17 pm

Yes, its just how to order them. No duplicates with RAND()
[url=http://www.linkedin.com/profile/view?id=96243938]Meet me on LinkedIn[/url]
[img]http://www.devppl.com/images/facebook_icon_small.jpg[/img] Help DEVPPL grow, [url=http://www.facebook.com/pages/DEVPPL/140524279390050]like DEVPPL on facebook[/url]!
Rasmus Lindström
Site Admin
 
Reputation: 18
Posts: 2829
Joined: Tue Aug 17, 2004 2:07 pm
Location: Sweden
Highscores: 1
Arcade winning challenges: 0
0

Loading

Postby Kotik » Tue Sep 07, 2004 10:07 pm

Yeah.... I understand :roll:
DEVPPL : News Publisher
Kotik
 
Reputation: 0
Posts: 1086
Joined: Mon Aug 23, 2004 1:25 am
Location: Sweden
Highscores: 0
Arcade winning challenges: 0
0

Loading

Postby Shinz » Tue Sep 07, 2004 11:13 pm

uhh yeah ...... ill have to try that one day ...
Image
Shinz
 
Reputation: 0
Posts: 289
Joined: Thu Aug 26, 2004 5:06 pm
Location: PS7+C4D=Love
Highscores: 0
Arcade winning challenges: 0
^ Back to Top