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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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]); } Quote Link to comment 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]); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.