Re: Using and Echoing Session Variables
| From: | Ligaya Turmelle | Date: | Mon, 19 Jul 2004 06:04:10 +0000 |
| Subject: | Re: Using and Echoing Session Variables | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190977@lists.php.net to get a copy of this message | ||
if they are all coming from the same query can't you assign them using the
fetch_assoc?
Ex:
$data = mysql_fetch_assoc($result);
$_SESSION['column1'] = $data['column1'];
$_SESSION['column2'] = $data['column2'];
$_SESSION['column3'] = $data['column3'];
...
Or am I confused :)
Respectfully,
Ligaya Turmelle
"Harlequin" <michael.mason@arraspeople.co.uk> wrote in message
news:20040718104843.53231.qmail@pb1.pair.com...
> So If I needed say 10 session variables all based on field values in the
> database I'd have to execute 10 separate queries and assign each variable
> separately...?
>
> If that's the case then fine - as I only need do it once I know, but it
does
> seem a rather long winded way of doing things.
>
> --
> -----------------------------
> Michael Mason
> Arras People
> www.arraspeople.co.uk
> -----------------------------
> "Jason Barnett" <jasbarne@indiana.edu> wrote in message
> news:20040718103920.15003.qmail@pb1.pair.com...
> > Harlequin wrote:
> >
> > > OK, so here's my conundrum...
> > >
> > > After verifying the user and pulling all fields from the record I
> declare
> > > two variables (just testing here):
> > > $_SESSION['UserID'] = UserID;
> >
> > now contains the string / constant UserID
> >
> > > $_SESSION['FurtherComments'] = FurtherComments;
> >
> > now contains the string / constant FurtherComments
> >
> > >
> > > on the next page I start a session, everything OK.
> > >
> > > I echo the UserID variable - fine.
> > >
> > > But the FurtherComments variable simply echoes "FurtherComments" even
> though
> > > there's a database field called "FurtherComments".
> >
> > You'd need to do the actual call to your database and select the
> FurtherComments
> > field, then assign the result of that query to
> $_SESSION['FurtherComments'].