Forum Moderators: coopster
My problem is, how do I track all of this data for a user? I have considered the session variable, a global variable, and a flat file. The problems arise when I consider that more than one user may be logged onto the system at the same time. How do I store their unique data in their own place?
A session really is a flat file, or I should say that the default configuration and session handling routines in PHP are setup as flat files. You start a session and PHP automagically assigns a unique filename to the session, storing your $_SESSION variables on the server and the session_name and unique number in a cookie. You see, all the data stays on the server and it matches the user up via that unique session number.
I believe the only limitations imposed on the files are those of the underlying operating system. PHP Sessions [php.net] in the manual pages is a must-read if you are going to be working with sessions at all.
Thanks,
hehe, just kidding you. I understand. Well, you can certainly store strings in your session files, but the bigger question at this point is do you really want to? I'm not sure how I would approach this any differently ... except maybe to keep each string in a file by itself and refer to that string in a "products" script. Maybe build a script or function that contains all the "html file string" filenames and use that to populate your session *cart* information. Then when it comes time to display it, read in that html file string.
Either or, it is going to work. Kind of messy though, I don't envy you.