RE: Problem storing DB_DataObject result in session

From: Date: Thu, 15 Dec 2005 23:55:17 +0000
Subject: RE: Problem storing DB_DataObject result in session
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22263@lists.php.net to get a copy of this message
I am really confused. Let me explain you what I am trying to accomplished. I have a remote server with a mysql DB. That DB has data on articles, with pictures and prices, orders,. I will like to build an application that will get a request like get_orderDetails(OrderID) and will return the lines of the order including the picture and will be send in a dataset, recordset or something like that using XML. That way we can build the client application however we want. Can I do this with PEAR. ?? If not, can you suggest with what. I already tried nuSOAP, and couldn't get the recordset back to the client. ( did not have problems retrieving one record) Thank you in advance. -----Mensaje original----- De: Joseph Szobody [mailto:php-newsgroup@signaturetechstudio.com] Enviado el: Miércoles, 14 de Diciembre de 2005 04:58 p.m. Para: pear-general@lists.php.net Asunto: Problem storing DB_DataObject result in session Folks, I have no problems storing a DB_DataObject in the session when there is one result record that has been fetched. However I'd really like to be able to do a find(), save the DataObject in a session variable, and then later come back to it and do a while($object->fetch()). For example... --- require_once 'dbo/Tbl_user.php'; require_once 'dbo/Tbl_customer_contact.php'; session_start(); if(!$_SESSION['dbo']) { $dbo = DB_DataObject::factory("tbl_user"); $dbo->id_role = 4; $dbo->find(); $_SESSION['dbo'] = $dbo; } else { DB_DataObject::debugLevel(1); $dbo = $_SESSION['dbo']; while($dbo->fetch()) { print_r($dbo); } } --- On the first page load the $dbo object is stored in the session variable. On the second page load, I was hoping to see the results of the fetch() loop, but instead I get this error: obj_Tbl_user: 0: fetched on object after fetch completed (no results found) Now it works if I call $dbo->find() again right before the while() loop, but the whole idea is to cache a DB result for use on multiple pages, saving trips to the database. How can I achieve this? Thanks, Joseph

« previous php.pear.general (#22263) next »