Re: [PHP] Best method to store shopping cart contents

2005-01-28 Thread Jochem Maas
Bosky, Dave wrote:
Do you have a simple example of how to create a multi-dimensional array and
store it in a session variable?
...
you also asked for a class example, seeing as your asking for this I don't
think your ready for the class example...
$_SESSION['mycart'] = array();
$_SESSION['mycart'][] = array('Product 1', 5.99);
$_SESSION['mycart'][] = array('Product 2', 4.99);
$_SESSION['mycart'][] = array('Product 3', 7.99);
print_r($_SESSION['mycart']);
---
this works due to the superglobal $_SESSION; in order to use the $_SESSION
var (accessable everywhere without the use of global keyword) you must
first call session_start(), which in turn must be called before any output
is sent to the browser.
a quote from the following URL: (read it)
http://nl2.php.net/session
"
As of PHP 4.1.0, $_SESSION is available as a global variable just like $_POST, $_GET, $_REQUEST and so on. Unlike 
$HTTP_SESSION_VARS, $_SESSION is always global. Therefore, you do not need to use the global  keyword for $_SESSION. 
Please note that this documentation has been changed to use $_SESSION everywhere. You can substitute $HTTP_SESSION_VARS 
for $_SESSION, if you prefer the former. Also note that you must start your session using session_start() before use of 
$_SESSION becomes available.
"

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


RE: [PHP] Best method to store shopping cart contents

2005-01-28 Thread Richard Lynch
Bosky, Dave wrote:
> Do you have a simple example of how to create a multi-dimensional array
> and
> store it in a session variable?

E.  Okay.



For your penance you now must read:
http://php.net/session_start
http://php.net/manual/en/language.types.array.php

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Best method to store shopping cart contents

2005-01-28 Thread Bosky, Dave
Do you have a simple example of how to create a multi-dimensional array and
store it in a session variable?

Regards,
~Dave

-
Play more pool! www.mbpoolplayers.com
-

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 28, 2005 11:35 AM
To: Bosky, Dave
Cc: php-general@lists.php.net
Subject: Re: [PHP] Best method to store shopping cart contents

Bosky, Dave wrote:
> I've written some nice shopping carts in Cold Fusion that use a session
> variable to hold an array of structures.
>
> I need to convert the shopping cart to PHP but I'm unsure of how to store
> the cart's contents using PHP.
>
> Should I create a multi-dimensional array and store it a session variable?

Sounds like a plan to me.

> Any good tutorials/examples on creating shopping cart apps using PHP?

There are a few zillion, actually...

Just Google for "PHP shopping cart" and you should find a ton of source
code, or a hundred carts you could just start using instead of
re-inventing the wheel.

-- 
Like Music?
http://l-i-e.com/artists.htm


HTC Disclaimer:  The information contained in this message may be privileged 
and confidential and protected from disclosure. If the reader of this message 
is not the intended recipient, or an employee or agent responsible for 
delivering this message to the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this communication is strictly 
prohibited.  If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your computer.  
Thank you.

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



Re: [PHP] Best method to store shopping cart contents

2005-01-28 Thread Richard Lynch
Bosky, Dave wrote:
> I've written some nice shopping carts in Cold Fusion that use a session
> variable to hold an array of structures.
>
> I need to convert the shopping cart to PHP but I'm unsure of how to store
> the cart's contents using PHP.
>
> Should I create a multi-dimensional array and store it a session variable?

Sounds like a plan to me.

> Any good tutorials/examples on creating shopping cart apps using PHP?

There are a few zillion, actually...

Just Google for "PHP shopping cart" and you should find a ton of source
code, or a hundred carts you could just start using instead of
re-inventing the wheel.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Best method to store shopping cart contents

2005-01-28 Thread Jochem Maas
Bosky, Dave wrote:
I've written some nice shopping carts in Cold Fusion that use a session
variable to hold an array of structures.
I need to convert the shopping cart to PHP but I'm unsure of how to store
the cart's contents using PHP.
 

Should I create a multi-dimensional array and store it a session variable?
I currently store an object (called Basket ;-) in the Session (for one of 
my projects)
which is in effect the same thing - works great - just remember that if you
have objects stored in your session then you must include the class definitions
_before_ you start the session.
 

Any good tutorials/examples on creating shopping cart apps using PHP?
if your a list member then you should have received an email from Richard
Lynch - he posted a link to a page he setup that lists pro/cons for LOTS
of commerce apps. that would be a good place to start looking!
 

Thanks,
Dave
 

 


HTC Disclaimer:  The information contained in this message may be privileged 
and confidential and protected from disclosure. If the reader of this message 
is not the intended recipient, or an employee or agent responsible for 
delivering this message to the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this communication is strictly 
prohibited.  If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your computer.  
Thank you.
not if you send to a mailing list it aint ;-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php