PHP gevorderde |
|
Nu krijg ik helemaal niets meer,
Ik heb dus maar eens $i geecho'd in de while en ik krijg 0 1 2 (dit klopt want er zouden 3 dingen uit de DB gehaald moeten worden)
EDIT: Hmmz;
<?php
if(($rRows = mysql_query('SELECT * FROM box')) !== false)
{
?>
<script type="text/javascript">
var singletext = new Array();
</script>
<?php
$i = 0;
while (($aRow = mysql_fetch_assoc($rRows)) !== false)
{
echo $i;
?>
<script type="text/javascript">
singletext[<?php echo $i++ ?>] = 'test<?php echo $i;?>';
</script>
<?php
}
?>
<script type="text/javascript">
if(document.layers){document.write('<ilayer id="ns4div" width="'+swidth+'" height="'+sheight+'" bgcolor='+sbcolor+'><layer id="ns4div1" width="'+swidth+'" height="'+sheight+'" onmouseover="sspeed=0;" onmouseout="sspeed=rspeed"></layer></ilayer>');}else if (document.getElementById || document.all){ document.write('<div style="position:relative;overflow:hidden;width:'+swidth+'px;height:'+sheight+'px;clip:rect(0 '+swidth+'px '+sheight+'px 0);background-color:'+sbcolor+';"><div id="iens6div" style="position:relative;width:'+swidth+'px;"></div></div>');}
</script>
<?php
}
else
{
echo '<p>'.mysql_error().'</p>';
}
?>
<?php if(($rRows = mysql_query('SELECT * FROM box')) !== false) { ?> <script type="text/javascript"> var singletext = new Array(); </script> <?php $i = 0; { ?> <script type="text/javascript"> singletext[ <?php echo $i++ ?>] = 'test <?php echo $i;? >'; </script> <?php } ?> <script type="text/javascript"> if(document.layers){document.write('<ilayer id="ns4div" width="'+swidth+'" height="'+sheight+'" bgcolor='+sbcolor+'><layer id="ns4div1" width="'+swidth+'" height="'+sheight+'" onmouseover="sspeed=0;" onmouseout="sspeed=rspeed"></layer></ilayer>');}else if (document.getElementById || document.all){ document.write('<div style="position:relative;overflow:hidden;width:'+swidth+'px;height:'+sheight+'px;clip:rect(0 '+swidth+'px '+sheight+'px 0);background-color:'+sbcolor+';"><div id="iens6div" style="position:relative;width:'+swidth+'px;"></div></div>');} </script> <?php } else { } ?>
Krijg ik eerst 2x test2, en vanaf dan test3,test1,test2,test3,...
EDIT2: En dit: http://pastebin.be/9639 geeft dan weer eerst 2x rij2 uit de DB, en vanaf dan rij3,rij1 (= undefined),rij2,rij3,rij1 (=undefined) |