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

----- Original Message -----
From: "Stephen" <[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?

Stephen Craton

"Life is a gift from God. Wasting it is like destroying a gift you got from
the person you love most." --

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to