diff options
author | Derek Allard <derek.allard@ellislab.com> | 2007-02-04 17:18:03 +0100 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2007-02-04 17:18:03 +0100 |
commit | c1ee65ba12164141b18aac49b0f210ed161f88b9 (patch) | |
tree | 1c07cef85c25a168ea1edfc6b59c32ef128a021d | |
parent | 356da23d8cc237674228f2383b72e878d661d41e (diff) |
added note: set_userdata() also supports setting one value at a time
-rw-r--r-- | user_guide/libraries/sessions.html | 17 |
1 files 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.</p> <p>Where <samp>$array</samp> is an associative array containing your new data. Here's an example:</p>
-<code>$newdata = array(<br />
- 'username' => 'johndoe',<br />
- 'email' => 'johndoe@some-site.com',<br />
- 'logged_in' => TRUE<br />
- );<br />
-<br />
-$this->session->set_userdata(<samp>$newdata</samp>);</code>
-
+<p><code>$newdata = array(<br />
+ 'username' => 'johndoe',<br />
+ 'email' => 'johndoe@some-site.com',<br />
+ 'logged_in' => TRUE<br />
+ );<br />
+ <br />
+ $this->session->set_userdata(<samp>$newdata</samp>);</code></p>
+<p>If you want to add userdata one value at a time, set_userdata() also supports this syntax. </p>
+<p><code>$this->session->set_userdata('some_name', 'some_value');</code></p>
<p class="important"><strong>Note:</strong> 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.</p>
|