Hi all,
Again, I am having problems with multiple dimensional arrays. Here it is:
I am trying to input data into the array from a MySQL query as follows:
for($i=0; $i<$q; $i++) {
for($j=0; $j<$a; $j++) {
$result2= mysql_query($sql2) or die (mysql_error());
//$ques results in a correct value from the database
$ques= mysql_result($result2, "$questions[$i]");
//Attempt to input data into array in two ways: [1] (not both ways at same time)
$questions2 = array("[$i]" => array("[$j]" =>"$ques"));
//[2] second way
$questions2[$i][$j]= "$ques";
//and I attempt to output as below for($k=0; $k<$q; $k++) {
for($l=0; $l<$a; $l++) {
echo "question " . $questions2[k][l] . "<br />";
}
}
//the output is
question
question
question
....
Any help you can give me will be appreciated, Thank you in advance,
Mario