diff options
Diffstat (limited to 'user_guide/libraries')
-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>
|