Discussion:
Banner rotation with links
Chris Carter
2007-02-14 16:29:26 UTC
Permalink
How can I rotate a banner as well as the link in it within a page using PHP.
This can be done as a include file php. Anybody please supply some code or a
link for this.

Thanks in advance.

Chris
--
View this message in context: http://www.nabble.com/Banner-rotation-with-links-tf3228157.html#a8968148
Sent from the PHP - General mailing list archive at Nabble.com.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Németh Zoltán
2007-02-14 16:37:13 UTC
Permalink
Post by Chris Carter
How can I rotate a banner as well as the link in it within a page using PHP.
This can be done as a include file php. Anybody please supply some code or a
link for this.
please go STFW for "banner rotation php script"

greets
Zoltán Németh
Post by Chris Carter
Thanks in advance.
Chris
--
View this message in context: http://www.nabble.com/Banner-rotation-with-links-tf3228157.html#a8968148
Sent from the PHP - General mailing list archive at Nabble.com.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Brad Fuller
2007-02-14 16:41:12 UTC
Permalink
-----Original Message-----
Sent: Wednesday, February 14, 2007 11:37 AM
To: Chris Carter
Subject: Re: [PHP] Banner rotation with links
Post by Chris Carter
How can I rotate a banner as well as the link in it within a page using
PHP.
Post by Chris Carter
This can be done as a include file php. Anybody please supply some code
or a
Post by Chris Carter
link for this.
please go STFW for "banner rotation php script"
greets
Zoltán Németh
Even better, download this free open source application which does it all
for you...

http://www.phpadsnew.com/

-Brad
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Tim
2007-02-14 16:46:34 UTC
Permalink
-----Message d'origine-----
Envoyé : mercredi 14 février 2007 17:41
À : 'Németh Zoltán'; 'Chris Carter'
Objet : RE: [PHP] Banner rotation with links
-----Original Message-----
Sent: Wednesday, February 14, 2007 11:37 AM
To: Chris Carter
Subject: Re: [PHP] Banner rotation with links
Post by Chris Carter
How can I rotate a banner as well as the link in it within a page using
PHP.
Post by Chris Carter
This can be done as a include file php. Anybody please
supply some
Post by Chris Carter
code
or a
Post by Chris Carter
link for this.
please go STFW for "banner rotation php script"
greets
Zoltán Németh
Even better, download this free open source application which
does it all for you...
http://www.phpadsnew.com/
-Brad
Yeah, maybe their should be an alternate list for "Where can i find the app
for me to do this" queries :D

Regards,

Tim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Tim
2007-02-14 16:41:28 UTC
Permalink
-----Message d'origine-----
Envoyé : mercredi 14 février 2007 17:29
Objet : [PHP] Banner rotation with links
How can I rotate a banner as well as the link in it within a
page using PHP.
This can be done as a include file php. Anybody please supply
some code or a link for this.
Thanks in advance.
Hi depends on "what moment you are changing the banner" if you are doing it
on a page change you can do this with PHP by querying a DB for a random
banner (or non random thats up to you to decide) entry to display, each time
you load the page.

If you are wanting to do the "banner change" based on a time interval you
would have to setup some javascript to do this for you, maybe generate it
using php that formerly queried a database of banner entries.

Google: banners +javascript first before posting, there's always an answer
;)

Regards,

Tim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Kevin Murphy
2007-02-15 16:32:38 UTC
Permalink
On my home page i have all my banners in a MySQL database which
includes the image path, the link, and the description as separate
fields. The then do a MySQL query with a query that will look
something like this:

$query = "select * FROM banner ORDER BY RAND() LIMIT 1";

Seems to work just fine.
--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326
Post by Chris Carter
How can I rotate a banner as well as the link in it within a page using PHP.
This can be done as a include file php. Anybody please supply some code or a
link for this.
Thanks in advance.
Chris
--
View this message in context: http://www.nabble.com/Banner-rotation-
with-links-tf3228157.html#a8968148
Sent from the PHP - General mailing list archive at Nabble.com.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jochem Maas
2007-02-15 16:57:17 UTC
Permalink
On my home page i have all my banners in a MySQL database which includes
the image path, the link, and the description as separate fields. The
$query = "select * FROM banner ORDER BY RAND() LIMIT 1";
Seems to work just fine.
just wait till you have 100000 items in that table :-)
in practice that may never happen and maybe MySQL can optimize a
SELECT that does "ORDER BY RAND() LIMIT 1"

(can anyone confirm what MySQL does with "ORDER BY RAND() LIMIT 1" exactly in terms
of scanning the table? - the MySQL docs don't mention whether this is scalable at all)

*but* if that is not the case then using a field (call it 'randomized' or something like that)
and indexing on that and then updating that field periodically with random
integers using a cronjob script would make the resulting query alot more robust ..
the compromise being that you don't get a different banner each request:

$query = "select * FROM banner ORDER BY randomized LIMIT 1";

the compromise can be mitigated some what by doing something like this
(assuming you use sessions):

// BRC = Banner Random Count
if (!isset($_SESSION['BRC']))
$_SESSION['BRC'] = 0;
$query = "select * FROM banner ORDER BY randomized LIMIT {$_SESSION['BRC']},1";
$_SESSION['BRC']++;
--Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326
Post by Chris Carter
How can I rotate a banner as well as the link in it within a page using PHP.
This can be done as a include file php. Anybody please supply some code or a
link for this.
Thanks in advance.
Chris
http://www.nabble.com/Banner-rotation-with-links-tf3228157.html#a8968148
Sent from the PHP - General mailing list archive at Nabble.com.
--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Edward Vermillion
2007-02-15 18:37:54 UTC
Permalink
Post by Jochem Maas
On my home page i have all my banners in a MySQL database which includes
the image path, the link, and the description as separate fields. The
$query = "select * FROM banner ORDER BY RAND() LIMIT 1";
Seems to work just fine.
just wait till you have 100000 items in that table :-)
in practice that may never happen and maybe MySQL can optimize a
SELECT that does "ORDER BY RAND() LIMIT 1"
(can anyone confirm what MySQL does with "ORDER BY RAND() LIMIT 1" exactly in terms
of scanning the table? - the MySQL docs don't mention whether this is scalable at all)
Apparently a lot of folks think it's a bad idea on large tables...

http://www.google.com/search?client=safari&rls=en&q=ORDER+BY+RAND
();&ie=UTF-8&oe=UTF-8
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Continue reading on narkive:
Loading...