1

So I started using MySQL-based sessions with session_module_name("user"); and I love it, and I might as well because I have to.

The only thing I'm missing are my beloved multidimensional arrays, and I'm at a juncture where they are most desired. How can I still use them, or is it a lost cause?

6
  • 1
    What's the problem? AFAIK - You should be able to store multidimensional arrays in session stored in mySQL without problems. Commented Oct 12, 2009 at 23:27
  • Yeah I don't know, they just don't show up in the database and don't follow the state from page to page. All my other variables work just fine... they usually look like this: count|i:13;user|s:1:"1";level|s:1:"2";theme|s:10:"fixeddream"; Commented Oct 12, 2009 at 23:34
  • That's what they look like in the database, in case something looks wrong to you. Commented Oct 12, 2009 at 23:36
  • @aaron - could this bug by your problem: bugs.php.net/bug.php?id=33772 Commented Oct 12, 2009 at 23:53
  • @cballou - I don't think so, but in all honesty, I don't completely understand everything mentioned there. It looks to be about classes and __destruct, and I don't employ either, unless PHP is employing them behind the scenes. Commented Oct 13, 2009 at 0:15

1 Answer 1

1

use seralize() method to convert your array data into a string representation (which is easily stored in a db). When you retrieve the data back from the db, use unseralize().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.