| | |
session questions
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 123
Reputation:
Solved Threads: 2
Hi, all
i want to have the "add to cart" function in my website which use session function:
Well basically the cart is mostly like others website cart: remember which have already been added and could add something more
Assume i have class.php, A.php and B.php
In my A.php
In my B.php
So i got the error and warnings information:
Fatal error: Cannot use object of type Item as array
warnings: session-start function: Node no longer exists and Cannot send session cache limiter
Thanks in advance and BOW!!
i want to have the "add to cart" function in my website which use session function:
Well basically the cart is mostly like others website cart: remember which have already been added and could add something more
Assume i have class.php, A.php and B.php
In my A.php
php Syntax (Toggle Plain Text)
<?php require_once("classes.php"); session_start(); $item = new Item($id, (string)$itemXML[0]->name, $quatity, $catalog);//Item is the class i define in class.php $_SESSION['cart'][$id] = $item;//// Add the item to the $_SESSION['cart'] session variable ?>
In my B.php
php Syntax (Toggle Plain Text)
<?php require_once("classes.php"); session_start(); $cart = $_SESSION['cart']; foreach($cart as $item) { //do the array loop } ?>
So i got the error and warnings information:
Fatal error: Cannot use object of type Item as array
warnings: session-start function: Node no longer exists and Cannot send session cache limiter
Thanks in advance and BOW!!
•
•
Join Date: Jan 2009
Posts: 123
Reputation:
Solved Threads: 2
sorry, changed A.php code:
Thanks
php Syntax (Toggle Plain Text)
<?php require_once("classes.php"); session_start(); $id = $_GET['id']; $itemXML = $xml->xpath("/root//item[@id='{$id}']"); $item = new Item($id, (string)$itemXML[0]->name, $quatity, $catalog);//Item is the class i define in class.php $_SESSION['cart'][$id] = $item;//// Add the item to the $_SESSION['cart'] session variable ?>
Thanks
![]() |
Similar Threads
- 2 questions involving scripts, select tag, and loading pages (PHP)
- regarding web service and some other questions (ASP.NET)
- Creating a multi-dimensional Session variable (PHP)
- PHP Session Variables (PHP)
- questions (Site Layout and Usability)
- Vbulletin 3.5.4 Newbie Questions/Problems (Existing Scripts)
- Why Data Structures???...QUESTIONS INSIDE (C++)
Other Threads in the PHP Forum
- Previous Thread: save html/static page as word document
- Next Thread: PHP based Changelog [need help]
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array basics beginner binary broken cakephp checkbox class cms code cron curl database date datepart directory display download dynamic echo email error file files folder form forms function functions google head href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail menu mlm mod_rewrite multiple mysql number oop parse password paypal pdf php phpmyadmin problem query radio random recourse recursion regex remote script search seo server sessions sms soap source space sql structure syntax system table tutorial update upload url validation validator variable video web webdesign xml youtube





