I want to get rows from MySQL Database and save two specific values(row[0] & row[6]) in $_SESSION variable for comparison later on. The code looks like below:
$sqlResult =mysql_query("SELECT * FROM questionbank WHERE quizName ='$quizNames' ORDER BY RAND() limit 6")
while ($row= mysql_fetch_array($sqlResult))
{
$questionPkId = $row[0];
echo $_SESSION['$questionPkId'] = $row[6];
}
The Problem is I can't get this values in other pages. Can I make an associative array with session variable (though i tried array_push(), But it did not work).
session_starton every page that uses$_SESSION?mysql_*functions. They are deprecated. Also, a tip, don'tSELECT *but write out the columns you need.'$questionPkID'is not going to evaluate to what you think it is...