Re: Array to $_GET variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike Smith wrote:
I am trying to cache a database recordset so users can sort, etc
without hitting the database everytime. I'm using ADODB to access a
MSSQL database.


$s = "SELECT id, part, description FROM parts\n"; $r = $db->Execute($s);

$parts = array(id=>array(),part=>array(),desc=>array())

while(!$r->EOF){
array_push($parts['id'],$r->fields[0]);
array_push($parts['part'],$r->fields[0]);
array_push($parts['desc'],$r->fields[0]);
$r->MoveNext();
}

// print_r($parts) displays array data.
Here's what I'm doing:

$v = serialize($parts);


echo "<a href=\"{$_SERVER['PHP_SELF']}?getvar=$v\">Link</a>\n";

If($_GET['getvar']){
$newvar = unserialize($_GET['getvar']);


//This does nothing
echo $newvar;
print_r($newvar);

}

Am i missing something very simple? Should I make the array a
$_SESSION variable, or how do others "cache" a recordset?

i would prefer $_SESSION!

btw.
 - do you see the ...?getvar=... in the URL ?
 - what does var_dump( $_GET['getvar'] );
 - do you tried urlencode();


-- Sebastian Mendel

www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com
www.sf.net/projects/phpdatetime        www.sf.net/projects/phptimesheet

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux