prcollin Posted July 5, 2007 Share Posted July 5, 2007 Also is there a place you can direct me to get a decent banner advertising script. I want a script that rotates banner advertisements so that I can have a banner advertising on my website. I am so used to creating strict html sites that i know nothing of php and I usually use JOOMLA lol the noobie cms. Finally dipping my feet into doing my own programming. Thanks for being patient Link to comment https://forums.phpfreaks.com/topic/58535-banner-advertising/ Share on other sites More sharing options...
Greaser9780 Posted July 5, 2007 Share Posted July 5, 2007 If you have a decent number of similar sized banners, you could place them in a database and use php to pull one out at random everytime the page is loaded or refreshed. Link to comment https://forums.phpfreaks.com/topic/58535-banner-advertising/#findComment-290319 Share on other sites More sharing options...
prcollin Posted July 5, 2007 Author Share Posted July 5, 2007 If you have a decent number of similar sized banners, you could place them in a database and use php to pull one out at random everytime the page is loaded or refreshed. That would be great is there a simple code for that. If I upload multiple .php files to my web domain and they all have includes statements for eachother will hte all work simultaneously. Link to comment https://forums.phpfreaks.com/topic/58535-banner-advertising/#findComment-290410 Share on other sites More sharing options...
BillyBoB Posted July 5, 2007 Share Posted July 5, 2007 or you could do somin like: $h= 0; $query = mysql_query("SELECT * FROM images"); while($array = mysql_fetch_array($query)) { $images[$h] = $array[name]; $h++; } $num = rand(0,$h); echo("<img src=\"images/$images[$num]\" />"); That should work Link to comment https://forums.phpfreaks.com/topic/58535-banner-advertising/#findComment-290420 Share on other sites More sharing options...
xyn Posted July 5, 2007 Share Posted July 5, 2007 alternativly you could do this... $query = mysql_query("SELECT * FROM `banners` WHERE `id` = RAND() LIMIT 1;"); while($data = mysql_fetch_array($query)) { echo($data[0]); } Link to comment https://forums.phpfreaks.com/topic/58535-banner-advertising/#findComment-290529 Share on other sites More sharing options...
prcollin Posted July 5, 2007 Author Share Posted July 5, 2007 like i said i am a dummy so the 'banners' would be the database they are all stored in right or no? alternativly you could do this... $query = mysql_query("SELECT * FROM `banners` WHERE `id` = RAND() LIMIT 1;"); while($data = mysql_fetch_array($query)) { echo($data[0]); } Link to comment https://forums.phpfreaks.com/topic/58535-banner-advertising/#findComment-290607 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.