I basically want to store this array "mysql_row" in a session variable when $Question==0
Then when question <> 0 recall "mysql_row" from the session variable... plz help i cant see what is wrong here.
<?
session_start();
?>
<?php
//if this is question 0, store the session array variable mysql_row
If ($Question == 0) {
$con = mysql_connect("localhost","xxx","xxx");
$selectdb = mysql_select_db("xxx_com",$con);
$query = "SELECT ID FROM CiteExams WHERE CiteExams.ExamType='Word' ORDER BY RAND() LIMIT 10";
$result = mysql_query($query) or die(mysql_error());
$mysql_row = array();
while ($row = mysql_fetch_assoc($result)) { array_push($mysql_row, $row['ID']); }
//store the array mysql_row into the session
$_SESSION['mysql_row'] = $mysql_row;
echo $mysql_row[$Question];
}
else {
//if the question is not 0 echo the value stored from the array
echo $mysql_row[$Question];
}
?>