General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 6th, 2002, 12:18 AM
alvira alvira is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 2 alvira User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
persistant cart tut, with no SQL!

Hi all, I am looking for a way to display the contents of my shopping cart without using a database for the time being. I have it down so I need to spit out everything in the $_SESSION array that has a value, but am lost on the way to start. Basically whenever someone clicks "add to cart", I then set the registered variable with a value. Then comes checkout time and everything has to be displayed. I have tried this but won't work...

for($i = 0; $i <= sizeof($_SESSION); $i++) {
if(isset($_SESSION['$i'])){
echo $_SESSION['$i'];
}
}

Any help would be greatly appreciated. I know of all the "free" scripts out there, but haven't found one that I understand completely yet, and I want to learn this for myself

Reply With Quote
  #2  
Old December 6th, 2002, 12:06 PM
eloso eloso is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 6 eloso User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You can try out with a foreach structure :

foreach($_SESSIONS as $key => $value) {
echo $value;
}

But you surely want to add up some validation on what is displayed, so maybe someting like :

foreach($_SESSIONS as $key => $value) {
if ($key == "whatever")
echo $value;
}


hope it will help

ciao!

Reply With Quote
  #3  
Old December 7th, 2002, 09:01 PM
alvira alvira is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 2 alvira User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the response. I'll give it a shot

Reply With Quote
  #4  
Old March 11th, 2003, 01:40 PM
afeltmate afeltmate is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 4 afeltmate User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
were you able to figure out how to do this? I would be interested in seeing the results if so.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > persistant cart tut, with no SQL!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway