473,412 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

How to rotate top page banner using php

268 100+
Hai friends,


I am very confused this task. please help me.
if five banners are stored in one location , I want to displayall the banners simultaniously in my application.

How to rotate the webpage top banner ? In my application i am getting the immage details using database.

Please send me any idea.
__________________
Thanks
Vssp
Aug 19 '06 #1
3 2055
sashi
1,754 Expert 1GB
Hi there,

am not PHP expert, but have created banner rotation script using ASP.. well.. i assume the logic is always same..

the question is do you need to show those banners in random order or u need to show them in sequence?

kindly follow the steps below and it should work fine..

1st step design / re-design your table structure as below..

id | fldPath | fldDetails | fldWidth | fldHeight | fldxyz

make sure the (id) is of numeric datatype as well as autonumber is set to be true..

2nd step..

write a simple function to generate numbers based on the total records found in your table..

let say, you have a total of 5 banner details in your database, make sure the random number generated must be within 1 and 5.. hope you get what i mean..

3rd step..
let assume, number 3 is generated by your random number function.. run SQL query to pick banner details whose (id) is 3 as well..

function to generate random number..
Expand|Select|Wrap|Line Numbers
  1. function randInt(min,max)
  2. {
  3.      var div = (max - min) + 1
  4.      var randNum = Math.random()
  5.      for (var i = 0; i <= div - 1; i++)
  6.      {
  7.           if (randNum >= i / div && randNum < (i+1) / div)
  8.           {return i + min}
  9.      }
  10. }
  11. var abc = randInt(1,5);
  12.  
show the banner using javascript based on randomly generated number..
Expand|Select|Wrap|Line Numbers
  1. if (abc == 1) {
  2.      document.write("<\"Your 1. HTML-Banner-Code\">");
  3. }
  4.  
Aug 19 '06 #2
vssp
268 100+
Thanks for your repaly
Aug 20 '06 #3
sashi
1,754 Expert 1GB
Hi VSSP,

anytime buddy.. hope the guide provided on my previous post helped you to get started with.. take care ny fren.. :)
Aug 20 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Eþref DURNA | last post by:
Hello, We have a web site which have 10 million page views in a day. We create a banner system. The web page will call the banner.com at the server side and gets the banner data the requested...
17
by: santel_helvis | last post by:
Hi All, Could anyone tell me how to rotate the image in javascript. Which concepts I should concentrate to rotate the image
6
by: sales | last post by:
Hello, I am trying to get my website checkout page to rotate / take turns displaying shopping comparison engine surveys rather than display them all 4 at the same time, thus overwhelming &...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
10
by: Joey_Stacks | last post by:
Does anyone know of a scipt that will rotate random div layers on page refresh? I have a primary content area front and center on my site homepage, and I'd like to rotate various chunks of html...
2
by: Salimunnisaa | last post by:
Hello friends, I am using an adrotator. I want the images to rotate for specific intervals. I also want to ad a banner. If I click on that it should take me to a different page. It is very urgent.
0
by: jasone | last post by:
Hey guys, im creating a website that will be mostly powered by php. I will start by giving you some backgroound: I want the website to be totally dependant, so the user can update it all...
8
by: Cirene | last post by:
I have 1 master page in the root of my website that I would like to share with all pages, even those in my /admin and /client directories. But when pages in the subdir's are viewed the img, css,...
0
by: Steve | last post by:
I have a requirement to place a single line banner "bar" at the top and bottom of every page containing a security message. The bar has to occupy the entire width of the page. I am using a Panel...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.