I have a problem with my javascript array. Bellow my code:
$namen = array();
$mainimg = array();
$sql1 = mysql_query("SELECT * FROM image WHERE id = ".$id.";");
echo "<div class='normal'>";
while($row = mysql_fetch_array($sql1))
{
$namen[] = $row['bild'];
$mainimg[] = $row['mainimg'];
$number_array = count($namen);
?>
<script type='text/javascript'>
<?php
for($a=1; $a <= count($namen); $a++){
$php_array = array($a => $row['bild']);
$js_array = json_encode($php_array);
echo "var javascript_array = ". $js_array . ";
";
echo "document.write(javascript_array + '<br />');";
}
?>
</script>
}
Now I get [object][Object] in the browser, but I wanted to printout the elements, the name of the pictures. What can I do?
Thanks for your help in advance.
Regards, Yanick