I have a problem to get in a session array from php into a javascript
I´m setting the sessions array here, the print_r is only for checking so it´s correct
while($row2[]=mysql_fetch_array($result2))
$_SESSION['row2'] = $row2;
print_r($_SESSION['row2'][0][0]);
print_r($_SESSION['row2'][0][1]);
print_r($_SESSION['row2'][0][2]);
and in my javascript i use this, alert is only for checking
var row2 =<?php echo json_encode($_SESSION['row2']) ?>;
alert (row2[0][0]);
alert (row2[0][1]);
alert (row2[0][2]);
row2[0][0] and row2[0][1], works fine, I get the numbers from the array
but row2[0][2] give me the value null, it should be some text in this field, it´s works fine with print_r($_SESSION['row2'][0][2]); in the php-code.
view sourcein your browser and see what doesvar row2 = ...become? (actually, see the JSON on the javascript side)2is in fact null. If echoing $row2[ 0 ][ 2 ] prints a value, then the problem is either when inserting the value & then extracting it from the$_SESSIONcollection or withjson_encode(), what is the value which should appear for $row[ 0 ][ 2 ]?