Mysql,PHP and arrays
I'm trying to retrieve data from a mysql table using a select statement and store the data in an array. I then want to go through the array and assign certain elements of the array to variables. To try and do this, I used the following code
$get_table = mysql_query("SELECT * from $table
where USER_ID = '5'");
$row_50 = array();
while ($row_50 = mysql_fetch_row( $get_table) )
I assumed that the while statement used with the array push command would push each row returned into the $ret50 array.
However, when I use the following to retrieve the first eight elements of the array and display the contents of the $_SESSION variables, they print the word Array to the browser.
$_SESSION['1TG1'] = $ret50;
$_SESSION['1WG1'] = $ret50;
$_SESSION['1DG1'] = $ret50;
$_SESSION['1LG1'] = $ret50;
$_SESSION['1SG1'] = $ret50;
$_SESSION['1AG1'] = $ret50;
$_SESSION['1GD1'] = $ret50;
$_SESSION['1PG1'] = $ret50;
Any idea's of what I'm doing wrong..?