
-----------------------------------
agnivohneb
Thu Jan 10, 2008 1:30 pm

Requesting a random site for site ring.
-----------------------------------
I need help for getting requesting a random site form a MySQL DB and then go to it.

Basically the DB is setup like this. Two tables one wr__ring and the other wr__site

wr__ring
Holds the information for the rings
The fields include: id (key), name, description, img, allowjoin
This table is really not important in this question. I just want to let you know there are more than one ring.

wr__site
Holds the information for all the sites
The fields include: id (key), ring, name, status, url, description, password, img, hits
The only fields important are id ring url ring equals the given ring id supplied
I was thinking of just picking a random number and match it with the id but there will not be a constant sequence of numbers, it could go 1,2,4,11,13,14 ... (from some being deleted and ring).

Now I know very little about PHP and MySQL so when it comes to random in this language I am lost.
Any Ideas on how I can get started? or even a sample code (explained of course).

-----------------------------------
Dan
Thu Jan 10, 2008 9:07 pm

RE:Requesting a random site for site ring.
-----------------------------------
SELECT * FROM wr__site ORDER BY RAND() LIMIT 1 


I think that whould do it, but i have not tested it.

-----------------------------------
octopi
Thu Jan 10, 2008 11:07 pm

Re: Requesting a random site for site ring.
-----------------------------------
You might want to read and consider using the following:

http://www.gorilla3d.com/v4/index.php/blog/entry/35

or

http://www.greggdev.com/web/articles.php?id=6


They'll help you make a solution that will be quick, (quicker than using the method already suggested) which is important if you plan for your site/webring to have many visits.

-----------------------------------
agnivohneb
Sat Jan 12, 2008 1:21 am

RE:Requesting a random site for site ring.
-----------------------------------
Thanks dan that should work I will give it a try

Sorry octopi but I am looking for simple. and thats not simple, well to me at least. If this will not work then I will give that a shot.
