summaryrefslogtreecommitdiffstats
path: root/user_guide/libraries/sessions.html
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2007-02-04 17:18:03 +0100
committerDerek Allard <derek.allard@ellislab.com>2007-02-04 17:18:03 +0100
commitc1ee65ba12164141b18aac49b0f210ed161f88b9 (patch)
tree1c07cef85c25a168ea1edfc6b59c32ef128a021d /user_guide/libraries/sessions.html
parent356da23d8cc237674228f2383b72e878d661d41e (diff)
added note: set_userdata() also supports setting one value at a time
Diffstat (limited to 'user_guide/libraries/sessions.html')
-rw-r--r--user_guide/libraries/sessions.html17
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 />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'username'&nbsp; => 'johndoe',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'email'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=> 'johndoe@some-site.com',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'logged_in' => TRUE<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
-<br />
-$this->session->set_userdata(<samp>$newdata</samp>);</code>
-
+<p><code>$newdata = array(<br />
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'username'&nbsp; => 'johndoe',<br />
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'email'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=> 'johndoe@some-site.com',<br />
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'logged_in' => TRUE<br />
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<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-&gt;session-&gt;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>