Re: session_name("CCLTrolley")
| From: | John Taylor-Johnston | Date: | Mon, 03 Oct 2005 18:11:43 +0000 |
| Subject: | Re: session_name("CCLTrolley") | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-223571@lists.php.net to get a copy of this message | ||
Excellent. Thanks. I think I follow what you have done. But to clarify, and learn, what are you doing with -= ?
$trolley[$item] -= $quantity;
Likewise, i had not followed what you were doing with the lines I commented out. They did not seem to work, and I succeeded in doing what I wanted without them. I'm a prof, as you can tell, and always have a question for an answer ;).
Thanks for your time and patience,
John
//Delete an entry:
if( isset( $_SESSION['TrolleyContents'][$_POST['RNum']] ) )
{
# $_SESSION['TrolleyContents'][$_POST['RNum']] -= 1;
# if( $_SESSION['TrolleyContents'][$_POST['RNum']] <= 0 )
# {
unset( $_SESSION['TrolleyContents'][$_POST['RNum']] );
# }
}
Robert Cummings wrote:
On Sun, 2005-10-02 at 01:01, Robert Cummings wrote:If you go with an array system might I suggest the following change to what I wrote:I'm resending a better way to do the simple trolley since you seemed to have created a Frankensteinian merge of the two examples I sent previously. if( isset( $trolley[$item] ) ) { $trolley[$item] -= $quantity; if( $trolley[$item] < 1 ) { unset( $trolley[$item] ); } }