From c1ee65ba12164141b18aac49b0f210ed161f88b9 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Sun, 4 Feb 2007 16:18:03 +0000 Subject: added note: set_userdata() also supports setting one value at a time --- user_guide/libraries/sessions.html | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/user_guide/libraries/sessions.html b/user_guide/libraries/sessions.html index b1ce8472f..087d2d1f7 100644 --- a/user_guide/libraries/sessions.html +++ b/user_guide/libraries/sessions.html @@ -161,14 +161,15 @@ having to run a database query when you need it.

Where $array is an associative array containing your new data. Here's an example:

-$newdata = array(
-                   'username'  => 'johndoe',
-                   'email'     => 'johndoe@some-site.com',
-                   'logged_in' => TRUE
-               );
-
-$this->session->set_userdata($newdata);
- +

$newdata = array(
+                    'username'  => 'johndoe',
+                    'email'     => 'johndoe@some-site.com',
+                    'logged_in' => TRUE
+                );
+
+ $this->session->set_userdata($newdata);

+

If you want to add userdata one value at a time, set_userdata() also supports this syntax.

+

$this->session->set_userdata('some_name', 'some_value');

Note: Cookies can only hold 4KB of data, so be careful not to exceed the capacity. The encryption process in particular produces a longer data string than the original so keep careful track of how much data you are storing.

-- cgit v1.2.3-24-g4f1b