Holding an array in a session
| From: | Shaun | Date: | Fri, 19 Nov 2004 09:54:00 +0000 |
| Subject: | Holding an array in a session | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-202494@lists.php.net to get a copy of this message | ||
Hi,
I have created an array of tables in my database and put it into a session
using the following code:
$_SESSION['ses_csv_files'][] = array();
$qid = mysql_query("SHOW TABLES");
$num = mysql_num_rows($qid);
for ($i = 0; $i < $num; $i++) {
$r = mysql_fetch_array($qid);
$_SESSION['ses_csv_files'][$i] = $r[0];
}
I would like to be able to print the current value of the session on various
pages in my application, however I can only find reference to looping
through an array in one go. I know I can use next() to increment the pointer
in the array, is it possible for the session to hold the current pointer in
the array, if so how can I display its value?
Thanks for any advice offered.