Greetings all.

While trying to create a session-based advertising model that does not rely on 
the existence of cookies, I ran into trouble: I can't figure out how to place 
the entire $_SESSION array into a MySQL table row, then retrieve it and use the 
information from one page to the next.

The best that I can do is copy the PHPSESSID into a MySQL row, then dissect the 
$_SESSION array so that each of its parts can be stored in a separate row of 
the same record. Then, with the $_GET variable, I am able to get the 
MySQL_last_id and retreive the information from the correct field, and it works 
across pages.

The only problem is this: should the $_SESSION array grow with more data--say, 
adding a first name variable, and a time-of-day varaible--then I need to update 
the MySQL table whenever I do this. Not a big deal, I know, but I'm frustrated 
with this.

One more thing: one of the variables in the $_SESSION array is an <img src> 
url, so it screws up the mysql insert, even when I use serialize.

Thanks for any help you can give.


.oO "Advertising? ack! - Should I help him or not? :P"

serialize() and base64encode() are your friend.

You can even create a class to store this information, if you wanted - so long as you have the class include()'d before you unserialize the object. In all likelihood, however, you'll prefer just the straight $_SESSION.

- Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.

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

Reply via email to