> I have a Javascript that I like to use with PHP/MYSQL, But I > don't know > how to mix the two... > > <SCRIPT LANGUAGE = "JavaScript"> > bName = navigator.appName; > bVer = parseInt(navigator.appVersion); > > if ((bName == "Netscape" && bVer >= 3) || > > (bName == "Microsoft Internet Explorer" && bVer >= > 4)) br = "n3"; > > else br = "n2"; > > if (br == "n3") { > > boardNum = 0; > boardSpeed = 4000; > > billboards = new Array(); > billboards[0] = new Image(); > billboards[0].src = "$x"; > billboards[1] = new Image(); > billboards[1].src = "$x"; > billboards[2] = new Image(); > billboards[2].src = "$x"; > billboards[3] = new Image(); > billboards[3].src = "$x"; > billboards[4] = new Image(); > billboards[4].src = "$x"; > billboards[5] = new Image(); > billboards[5].src = "$x"; > billboards[6] = new Image(); > billboards[6].src = "$x"; > billboards[7] = new Image(); > billboards[7].src = "$x"; > } > > [I like to make $x to be called from the database...] > > > function rotateBoard() { > > document.billboard.src = billboards[boardNum].src; > > if (boardNum < billboards.length - 1) { > > boardNum++; > > } else { > > boardNum = 0; > > } > > } > > function jumpBillboard() { > > window.location.href = url[boardNum]; > } > </SCRIPT>
Try something like this billboards = new Array(); <? $cursor = <<sql query here>> $i = 0; while ($something from database) { ?> billboards[<?=$i?>] = new Image(); billboards[<?=$i?>].src = "<?=$something?>"; <? $i++; } ?> Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php