you can use SQL:
SELECT id, url, image FROM tblAdds ORDER BY RAND() LIMIT 1

I think thats just about it, that should evenly show them, if you want to
bias the displying of your ads you would need to get a count of the ads in
the DB, then use some random number generated from PHP to chose which to
use.

Andrew
----- Original Message -----
From: "Stephen" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Saturday, November 09, 2002 7:45 PM
Subject: [PHP] Rotating Ads


I have a link exchange script and I need to rotate the ads each time a page
refreshes. How exactly can I do this?

I have an id field for each ad. How could I display a different ad each time
the page refreshes using the id field?

Thanks,
Stephen Craton
http://www.melchior.us

"Life is a gift from God. Wasting it is like destroying a gift you got from
the person you love most." -- http://www.melchior.us


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to