<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Simple PHP Banner Ad Rotator Script</title>
	<atom:link href="http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/</link>
	<description>Technical Articles, Musings and Opinions from Tech-Evangelist</description>
	<lastBuildDate>Wed, 21 Jul 2010 17:18:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: Distractedthinking</title>
		<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/comment-page-1/#comment-12497</link>
		<dc:creator>Distractedthinking</dc:creator>
		<pubDate>Wed, 27 Jan 2010 11:08:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/#comment-12497</guid>
		<description>cool script, it is working cool with jpg and swf... thanks a lot</description>
		<content:encoded><![CDATA[<p>cool script, it is working cool with jpg and swf&#8230; thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ncube digital</title>
		<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/comment-page-1/#comment-12204</link>
		<dc:creator>ncube digital</dc:creator>
		<pubDate>Mon, 07 Dec 2009 18:00:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/#comment-12204</guid>
		<description>I am in the process of building a website and wanted a database driven php random banner rotator. this served a good purpose so i thought i would publish a simple addition in order to make it database driven. hopefully this will help anyone who wants to build on this nice snippet from TE.

php script is as follows;

//include database connection details
include(&quot;includes/connect.php&quot;);

mysql_connect($dbhost, $dblogin, $dbpass);

@mysql_select_db($db) or die(&#039;Could not select db&#039;);
$result = mysql_query(&quot;SELECT * FROM test&quot;) or die(0);

while ($row = mysql_fetch_array($result)){
$bannerAd[] = $row[&#039;bannerimg&#039;];
}

$adCount = count($bannerAd)-1;
//the -1 here serves to avoid a blank image. in my test the db had 3 records, the script sees 3 within the array but as the array starts from 0 the value of 3 in the array creates a blank image.

$randomAdNumber = mt_rand(0, $adCount);
//the 0 rather than 1 here is similar to the above so that the first record in the db shows up. if this is set as 1 then it will not read the 0 (first) value in the array

echo $bannerAd[$randomAdNumber];

The code blocks are contained within the db records.

I&#039;ll check back here every few days incase of any questions.</description>
		<content:encoded><![CDATA[<p>I am in the process of building a website and wanted a database driven php random banner rotator. this served a good purpose so i thought i would publish a simple addition in order to make it database driven. hopefully this will help anyone who wants to build on this nice snippet from TE.</p>
<p>php script is as follows;</p>
<p>//include database connection details<br />
include(&#8220;includes/connect.php&#8221;);</p>
<p>mysql_connect($dbhost, $dblogin, $dbpass);</p>
<p>@mysql_select_db($db) or die(&#8216;Could not select db&#8217;);<br />
$result = mysql_query(&#8220;SELECT * FROM test&#8221;) or die(0);</p>
<p>while ($row = mysql_fetch_array($result)){<br />
$bannerAd[] = $row['bannerimg'];<br />
}</p>
<p>$adCount = count($bannerAd)-1;<br />
//the -1 here serves to avoid a blank image. in my test the db had 3 records, the script sees 3 within the array but as the array starts from 0 the value of 3 in the array creates a blank image.</p>
<p>$randomAdNumber = mt_rand(0, $adCount);<br />
//the 0 rather than 1 here is similar to the above so that the first record in the db shows up. if this is set as 1 then it will not read the 0 (first) value in the array</p>
<p>echo $bannerAd[$randomAdNumber];</p>
<p>The code blocks are contained within the db records.</p>
<p>I&#8217;ll check back here every few days incase of any questions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doogie</title>
		<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/comment-page-1/#comment-11960</link>
		<dc:creator>Doogie</dc:creator>
		<pubDate>Fri, 13 Nov 2009 21:34:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/#comment-11960</guid>
		<description>There is no tracking with this script.</description>
		<content:encoded><![CDATA[<p>There is no tracking with this script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: spirosMR</title>
		<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/comment-page-1/#comment-11949</link>
		<dc:creator>spirosMR</dc:creator>
		<pubDate>Wed, 11 Nov 2009 14:58:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/#comment-11949</guid>
		<description>Hello guys. I want to ask if I can track every click on each ad with this script. Thank you in advance.</description>
		<content:encoded><![CDATA[<p>Hello guys. I want to ask if I can track every click on each ad with this script. Thank you in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: needmusic</title>
		<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/comment-page-1/#comment-11288</link>
		<dc:creator>needmusic</dc:creator>
		<pubDate>Mon, 15 Jun 2009 00:02:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/#comment-11288</guid>
		<description>Thanks for this script . It works perfect.
I wonder if it`s possible to rotate background images???</description>
		<content:encoded><![CDATA[<p>Thanks for this script . It works perfect.<br />
I wonder if it`s possible to rotate background images???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sharedrecipesdotorg</title>
		<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/comment-page-1/#comment-11166</link>
		<dc:creator>sharedrecipesdotorg</dc:creator>
		<pubDate>Sat, 30 May 2009 11:20:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/#comment-11166</guid>
		<description>wow, i just had to take the time to leave a message of a HUGE thanks for this. i have been hunting around for this exact thing for awhile now, and not to rotate banners. this script worked so i could rotate videos on my site. i have around 40,000 pages and the way my script works i could only add a single code for all pages to share, this little php code makes it so visitors hunting around on my site will get some new stuff to watch with each page. all i did was enter the codes for the video embeds where the &quot;banner&quot; codes would go and it works perfect! thank you so much! i cant wait to add dozens more :) man, this would of come in handy on the sites i used to have.</description>
		<content:encoded><![CDATA[<p>wow, i just had to take the time to leave a message of a HUGE thanks for this. i have been hunting around for this exact thing for awhile now, and not to rotate banners. this script worked so i could rotate videos on my site. i have around 40,000 pages and the way my script works i could only add a single code for all pages to share, this little php code makes it so visitors hunting around on my site will get some new stuff to watch with each page. all i did was enter the codes for the video embeds where the &#8220;banner&#8221; codes would go and it works perfect! thank you so much! i cant wait to add dozens more <img src='http://www.tech-evangelist.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  man, this would of come in handy on the sites i used to have.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doogie</title>
		<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/comment-page-1/#comment-10856</link>
		<dc:creator>Doogie</dc:creator>
		<pubDate>Fri, 01 May 2009 15:18:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/#comment-10856</guid>
		<description>Hi EV

You can have as many images and code blocks as you want. There is no limit. Just make sure that your array is numbered sequentially with no number gaps.</description>
		<content:encoded><![CDATA[<p>Hi EV</p>
<p>You can have as many images and code blocks as you want. There is no limit. Just make sure that your array is numbered sequentially with no number gaps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EV</title>
		<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/comment-page-1/#comment-10855</link>
		<dc:creator>EV</dc:creator>
		<pubDate>Thu, 30 Apr 2009 18:09:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/#comment-10855</guid>
		<description>Hi - great script! Wondering how many images are allowed in an ad block using this script? Can you have only single digits 1-9 or can you go beyond this? Thanks for posting such a CLEAN useful script!</description>
		<content:encoded><![CDATA[<p>Hi &#8211; great script! Wondering how many images are allowed in an ad block using this script? Can you have only single digits 1-9 or can you go beyond this? Thanks for posting such a CLEAN useful script!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Engineer</title>
		<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/comment-page-1/#comment-10489</link>
		<dc:creator>Engineer</dc:creator>
		<pubDate>Fri, 06 Mar 2009 18:23:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/#comment-10489</guid>
		<description>This is a wonderful code. You can even include a google script to run in conjunction with the regular ads. 
Absolutely wonderful. 
Thank you.</description>
		<content:encoded><![CDATA[<p>This is a wonderful code. You can even include a google script to run in conjunction with the regular ads.<br />
Absolutely wonderful.<br />
Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doogie</title>
		<link>http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/comment-page-1/#comment-10424</link>
		<dc:creator>Doogie</dc:creator>
		<pubDate>Thu, 26 Feb 2009 14:26:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/08/03/php-banner-ad-script/#comment-10424</guid>
		<description>Hi Joe

I assume that you want to set up two separate ad blocks in different locations on a web page. If that is correct, then the easiest solution would be to use the same PHP routine twice on the page, but include different ads in each group. That is the best way to assure that the same ad does not display in the two locations at the same time.</description>
		<content:encoded><![CDATA[<p>Hi Joe</p>
<p>I assume that you want to set up two separate ad blocks in different locations on a web page. If that is correct, then the easiest solution would be to use the same PHP routine twice on the page, but include different ads in each group. That is the best way to assure that the same ad does not display in the two locations at the same time.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
