Re: saving resource objects

From: Date: Wed, 17 Dec 2003 16:16:38 +0000
Subject: Re: saving resource objects
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-172887@lists.php.net to get a copy of this message
"Michael Lewis" <mlewis@xelent.net> wrote in message news:029801c3c443$a1fbea00$0400a8c0@server... > I posted this on the PHP-DB list and then realized it was a more general > question about PHP than DB so I am posting it here also hoping someone can > help. > > I have a fairly common problem that I have not been able to find the > solution for in the documentation and FAQs. I have to access a MSSQL box > from a LAMP box using PHP. That part works fine (thank you freetds.org). I > need to display results from user queries 10 at a time with the basic NEXT > and BACK logic. I can use the mssql_data_seek function to move amongst the > record set. The problem is how do I save the results variable between web > page updates? I cannot save the record set variable in my session because it > always returns as zero. Consider the following code: > > <?php > session_start(); > include("localsettings.php"); > $s = mssql_connect($Server, $User, $Pass) or die("Couldn't connect to SQL > Server on $Server"); > mssql_select_db($SDB, $s) or die("Couldn't open database $SDB"); > $sql="select * from products where prod_id='95038'"; > $ress=mssql_query($sql) or die(mssql_get_last_message()); > $_SESSION['ress']=$ress; > print $ress."\n"; > $ress=$_SESSION['ress']; > print $ress."\n"; > ?> > > The first time I print RESS is comes back as RESOURCE OBJECT #12, the second > time as 0. When I look in the session file, it is zero. > > Help! > > How can I pass this variable and its contents so they are usable to the next > web page? > > Thanks in advance. > > Michael Although still in beta phase, you might want to have a look at what SRM could do for you. www.vl-srm.net

« previous php.general (#172887) next »