Re: Rotating Ads

From: Date: Sat, 09 Nov 2002 19:50:27 +0000
Subject: Re: Rotating Ads
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-123613@lists.php.net to get a copy of this message
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" <webmaster@melchior.us> To: "PHP List" <php-general@lists.php.net> 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

« previous php.general (#123613) next »