I have written the following while loop in a php file. The file does exactly what I want it to do. However, my code editing program (Netbeans IDE 7.0.1) keeps indicating the following error: “missing ) after argument list”. The error is attached to the line inside the javascript tags. Is there a problem in how I’m creating the var Topcaption? The code seems to work fine in IE, FF and Chrome. Thanks for any advice you can offer!
if ($totalRows_Top_Slides != 0) {
mysql_data_seek($Top_Slides,0);
$i = 1;
$j = 100;
while ($row = mysql_fetch_array($Top_Slides)) {
?>
<script type="text/javascript">
var Topcaption<?php echo $i;?> = "<?php echo $row['caption'];?>";
</script>
<?php
$Top_images .= "<img id=\"Topimage" . $i . "\" class=\"slide_out\" style=\"z-index: " . $j . "\" src=\"" . $row['file_folder'] . $row['file'] . "\" width=\"280\" height=\"170\" alt=\"\" />";
$i = $i + 1;
$j = $j - 1;
}
I’ve pasted your sample code into my version of NetBeans on Ubuntu and it simply appears to be a bug in NetBeans 7.0.1. To fix, upgrade to Netbeans 7.1.
As a side-note, for sanity’s sake, I recommend changing your code to:
That way, you will only have 1 script tag, rather than 100.