C.R.Vegelin wrote:
Hi All,

Q: Is it possible to transfer a query result to another script ?
For example with (fragments of) the following 2 scripts:

Engine.php
----------------
$result = mysqli_query($connect, $myquery);
if (!$result) error ...
if (mysqli_num_rows($result) == 0) error ...
$_SESSION['result'] = $result;
header("Location: Report.php");

Report.php
----------------
$result = $_SESSION['result'];
while ($row = mysqli_fetch_array($result)) ...

This last line gives "Couldn't fetch mysqli_result".
Is this because the result set is local to Engine.php ?

TIA, Cor


You cannot transfer the Result ID itself, but you could loop through the results, create an array or object with all the returned data. Then store that in the $_SESSION['results'] variable in the first page. Then pull the data out of the $_SESSION array on the second page.

But, the result id / mysql result handler is only available within the lifetime 
of the current script.

When the script ends, the all resource handlers get removed!

The only thing that my help, is if you use persistent connections in mysql 
using mysql_pconnect()

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to