My first foray into classes & objects.
When retrieving a set of records, I'm using a class to build an object. At
this time I save each record/object into a Session array by doing this:
$rows = mysql_num_rows($qrslts);
if ($rows > 0)
$row = mysql_fetch_array($qrslts);
$e = new Entry;
$evts = $e;
array_push($_SESSION['TMScurr_evts'],$e); // THIS DOESN'T
$cls_errs .= " Stored $e->event in sess var $i-1; "; // THIS
$cls_errs .= "Could not retrieve event record for
The above code works AFAIK - the line above the array_push correctly stores
my retreived record data in the $evts array just fine and I can see the
data when I use that array to display my page.
Note also that the var $cls_errs following the array_push does show me that
valid values are being stored in $e
Later on, in my main process I attempt to retreive the contents of my
Session var to use to re-display the data. The code for that doesn't
display any values. In trying to debug this here is what I've done:
$cnt = count($_SESSION['TMScurr_evts']);
echo "In Display process with $cnt recs in session var TMScurr_evts. ";
// THIS WORKS
$e = new Entry;
$e = array_pop($_SESSION['TMScurr_evts']);
echo " in Display process - sess event $i is $e->event<br>"; //
This debugging code correctly tells me how many entries are in the Session
array variable, but the attempt to echo the values stored in the first field
of each object contained in it shows blank for each one.
What am I doing wrong when I try to pull the contents of my session array
out and store them back into an Entry object, one at a time, so that I can
display the object on my webpage??
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php