php-general Digest 27 Mar 2006 01:34:15 -0000 Issue 4036
Topics (messages 232574 through 232576):
Re: Oject passed via session error
232574 by: Chris
Re: PHP Links
232575 by: Kevin Waterson
Re: Creation and transfer of object thru session
232576 by: Chris
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
You need to declare the class before you call session_start(). Otherwise
it can't create the object properly.
Peter Lauri wrote:
Hi,
I do this:
<?php
session_start();
require_once('classes/ns_cart.class.php');
if(!isset($_SESSION['ns_cart'])) $_SESSION['ns_cart'] = new NScart();
?>
The output will be the following with print_r of the $_SESSION:
--------------------
Array
(
[ns_cart] => nscart Object
(
[myProducts] => Array
(
[0] => ns_product Object
(
---------------------
When I reloads the page I get the following:
--------------------
Array
(
[ns_cart] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => nscart
[myProducts] => Array
(
[0] => __PHP_Incomplete_Class Object
---------------------
What is this? I am confused...
/Peter
--- End Message ---
--- Begin Message ---
This one time, at band camp, Thomas Bonham <[EMAIL PROTECTED]> wrote:
> I'm trying to find out how make following happen
>
> Example:
> http://www.example.com/test.php?id=20
in test.php put this code
<?php echo $_GET['id']; ?>
Kevin
--
"Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote."
--- End Message ---
--- Begin Message ---
Peter Lauri wrote:
Hi,
I am creating an object from a Web Service. Throughout a session I would
like to keep the object that was created in the beginning of the session.
The reason for this is that the creation of the object takes some time
because of the communication with the Web Service. As I see it, there are
two possibilities:
1. Save the object in the $_SESSION variable, because the objects are not
big
2. Serialize the object and save it to a database, and use $_SESSION to keep
reference to the database
What is to prefer? What are the benefits of using 1 against using 2? Is
there any 3rd option?
I'd probably go with #1 mainly because it's always available through
$_SESSION - you don't have to hit the db to keep getting it.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---