How to rewrite the code so do the loop in this case?
<?php
require("connect.php");
$banner1 = mysql_query("SELECT * FROM banner WHERE bannerid ='1'");
$row1 = mysql_fetch_assoc($banner1);
$bannerpath1 = ($row1['bannerpath']);
$bannerheight1 = ($row1['bannerheight']);
$bannerwidth1 = ($row1['bannerwidth']);
$bannerdescription1 = ($row1['bannerdescription']);
$banner2 = mysql_query("SELECT * FROM banner WHERE bannerid ='2'");
$row2 = mysql_fetch_assoc($banner2);
$bannerpath2 = ($row2['bannerpath']);
$bannerheight2 = ($row2['bannerheight']);
$bannerwidth2 = ($row2['bannerwidth']);
$bannerdescription2 = ($row2['bannerdescription']);
$banner3 = mysql_query("SELECT * FROM banner WHERE bannerid ='3'");
$row3 = mysql_fetch_assoc($banner3);
$bannerpath3 = ($row3['bannerpath']);
$bannerheight3 = ($row3['bannerheight']);
$bannerwidth3 = ($row3['bannerwidth']);
$bannerdescription3 = ($row3['bannerdescription']);
?>
<style type="text/css">
#marqueecontainer{
position: relative;
width: 615px; /*marquee width */
height: 100px; /*marquee height */
background-color: black;
overflow: hidden;
border: 2px Solid Purple;
padding: 2px;
padding-left: 2px;
}
</style>
<script type="text/javascript">
/***********************************************
* Cross browser Marquee II- c Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?
////NO NEED TO EDIT BELOW THIS LINE////////////
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''
function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}
function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}
if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee
</script>
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
<!--YOUR SCROLL CONTENT HERE-->
<h4>
<img src='<?php echo"$bannerpath1"; ?>' width='<?php echo"$bannerwidth1"; ?>' height='<?php echo"$bannerheight1"; ?>' border='0'> <?php echo"<font color='#8D38C9'>$bannerdescription1"; ?>
<br><br><br><br><br><br>
<img src='<?php echo"$bannerpath2"; ?>' width='<?php echo"$bannerwidth2"; ?>' height='<?php echo"$bannerheight2"; ?>' border='0'> <?php echo"<font color='#8D38C9'>$bannerdescription2"; ?>
<br><br><br><br><br><br>
<img src='<?php echo"$bannerpath3"; ?>' width='<?php echo"$bannerwidth3"; ?>' height='<?php echo"$bannerheight3"; ?>' border='0'> <?php echo"<font color='#8D38C9'>$bannerdescription3"; ?>
<br><br><br><br><br><br>
</h4>
<!--YOUR SCROLL CONTENT HERE-->
</div>
</div>