For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > November 2005 > Oh Master I seek your advice









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Oh Master I seek your advice
Busy

2005-11-28, 6:57 pm

Oh Master I s your advice



Please can you tell me how do I get this:



$query = "SELECT * FROM bookings WHERE booking_ref='$uid' ORDER BY date
ASC";

$result = mysql_query($query);



Into a $_SESSION[‘variable’];



So I can move to another page and later retrieve the result in a useable
form from the $_SESSION[‘variable’];?

Thank you.
Oli Filth

2005-11-28, 6:57 pm

Busy said the following on 28/11/2005 19:31:
> Oh Master I s your advice
>
>
>
> Please can you tell me how do I get this:
>
>
>
> $query = "SELECT * FROM bookings WHERE booking_ref='$uid' ORDER BY date
> ASC";
>
> $result = mysql_query($query);
>
>
>
> Into a $_SESSION[‘variable’];
>
> So I can move to another page and later retrieve the result in a useable
> form from the $_SESSION[‘variable’];?
>


You cannot store recordset resources (i.e. $result) in session
variables. The best you can do is to fetch all rows of the result into
an array, and put that into a $_SESSION variable.

e.g.

while ($row = mysql_fetch_assoc($result))
{
$_SESSION['results'][] = $row;
}


(NOT TESTED)


--
Oli
Meião

2005-11-28, 6:57 pm

Anyway, next time, try to describe your problem into subject. Not say
you s master's help.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com