Page 1 of 1

putting info retreived from mysql on the next web page

Posted: Tue Nov 19, 2002 6:43 pm
by pocoloco
I have retreived information from my database using SELECT * FROM 'table, this info is stored as $result.

I want to use the info stored as $result on the next page.

I have tried registering $result with a session (i.e. session_register("result") ) and after opening the session i have tried to access the info using mysql_fetch_array. This doesn't work.

Does this make sense?

What do i do?

Do i have to do something with $result before registering it with a session?

Please help a poor <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> off scouser!

Posted: Tue Nov 19, 2002 6:56 pm
by mydimension
unfortunately $result does not contain the output of your query. it contains a resource identifier. it points to a temporary table created for the current script/session. once that script complets the temporary table is destroyed and the resource indentifier is no longer any good. without getting complicated the is no easy way to carry over a query from one page to another. best thing to do is re-query in the next page.

Posted: Wed Nov 20, 2002 2:15 am
by twigletmac
You could also save the result of the query into a proper array that you could carry over using sessions:

Code: Select all

$result_array = array();
while ($row = mysql_fetch_assoc($result)) {
    $result_array&#1111;] = $row;
}
Mac