Codes here !
Moderators: macek, egami, gesf
by jumpsalty » Wed Nov 20, 2002 11:36 pm
how do i select random data from a table?
-
jumpsalty
- New php-forum User

-
- Posts: 3
- Joined: Wed Nov 20, 2002 11:31 pm
by Oleg Butuzov » Sat Nov 23, 2002 10:10 am
selecrt * from sometable order by rand() limit 1
-
Oleg Butuzov
- Last Samuray

-
- Posts: 831
- Joined: Sun Jun 02, 2002 3:09 am
by jumpsalty » Wed Dec 11, 2002 10:14 pm
the method that you use return all data and then we choose randomly from the data returned. problem if there is large data in the table
-
jumpsalty
- New php-forum User

-
- Posts: 3
- Joined: Wed Nov 20, 2002 11:31 pm
by Oleg Butuzov » Thu Dec 12, 2002 12:39 am
$n=10; //num of recordes
selecrt `yourrows` from sometable order by rand() limit $n
or use a few querys =)
-
Oleg Butuzov
- Last Samuray

-
- Posts: 831
- Joined: Sun Jun 02, 2002 3:09 am
Return to mySQL & php coding
Who is online
Users browsing this forum: No registered users and 1 guest