Re: asigning an array of variables to $_SESSION
| From: | Justin Patrin | Date: | Fri, 02 Apr 2004 18:16:37 +0000 |
| Subject: | Re: asigning an array of variables to $_SESSION | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182160@lists.php.net to get a copy of this message | ||
Andy B wrote:
hi... i need to assign an array to $_SESSION. the reason for this is that i have a page that gets data from 2 different tables from the same mysql db all at the same time... there is guestbook (for the guestbook) and events (for the events section). i guess i would need to know 2 things: 1. can only 1 call to mysql_connect deal with 2 different table calls at the same time?Yes, just use different statement handles
2. since "guestbook" and "events" have the same exact field names i need to have $guestbook array and $events array assigned to $_SESSION so they dont get mixed up. i have something like this to start with: $query=mysql_query("select * from guestbook order by Number ASC")||die(mysql_error()); while($guestbook=mysql_fetch_array($query)){ //this is as far as i got so far //how and where would i assign $guestbook to //$_SESSION so i would have something like $_SESSION //['guestbook']['Number']? }$arr = array(1, 2, 3, 4, 5); $_SESSION['guesbook'] = $arr; or $_SESSION['guestbook']['Number'] = $value; -- paperCrane <Justin Patrin>