<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">

    <title type="text">CodeIgniter Forums</title>
    <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/" />
    <link rel="self" type="application/atom+xml" href="http://codeigniter.com/forums/atom/" />
    <updated>0</updated>
    <rights>Copyright (c) 2012</rights>
    <generator uri="http://www.pmachine.com/" version="2.2.2">ExpressionEngine</generator>
    <id>tag:codeigniter.com,2012:02:13</id>


    <entry>
      <title>Passing data around from view to view unlimited number of times without rebuilding the data array</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/210925/" />      
      <id>tag:codeigniter.com,2012:forums/viewthread/.210925</id>
      <published>2012-02-13T09:48:25Z</published>
      <updated>0</updated>
      <author><name>vladbabii</name></author>
      <content type="html">
      <![CDATA[
        <p>I&#8217;m loading views from within views multiple times and to avoid rebuilding the data array i create a self-reference to it.</p>

<p>$data=array();<br />
$data[&#8216;data&#8217;]=&amp;$data;</p>

<p>then set some other values</p>

<p>$data[&#8217; .. &#8216;]= ...</p>

<p>then load the view</p>

<p>$this-&gt;load-&gt;view(&#8216;view1&#8217;,$data);</p>

<p>Inside view1 i have<br />
&lt;?php $this-&gt;load-&gt;view(&#8216;view2&#8217;,$data); ?&gt;</p>

<p>Inside view2 i have<br />
&lt;?php $this-&gt;load-&gt;view(&#8216;view3&#8217;,$data); ?&gt;</p>

<p>And in view3 i use some of the variables in $data.</p>

<p><b><span style="font-size:14px;">My question is: are there any reasons not to use this method?</span></b></p>

<p><br />
Code example below:</p>

<p>Controller</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">index</span><span style="color: #007700">()<br /></span><span style="color: #0000BB">&#123;<br />&nbsp;$data</span><span style="color: #007700">=array();<br />&nbsp;</span><span style="color: #0000BB">$data&#91;</span><span style="color: #DD0000">'data'</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">=&amp;</span><span style="color: #0000BB">$data</span><span style="color: #007700">;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;self&nbsp;reference&nbsp;that&nbsp;i&nbsp;use<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$data&#91;</span><span style="color: #DD0000">'page_title'</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">=</span><span style="color: #DD0000">'title'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$data&#91;</span><span style="color: #DD0000">'footer_text'</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">=</span><span style="color: #DD0000">'bye'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$data&#91;</span><span style="color: #DD0000">'js_files'</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">=array();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$data&#91;</span><span style="color: #DD0000">'js_files'</span><span style="color: #0000BB">&#93;&#91;&#93;</span><span style="color: #007700">=</span><span style="color: #DD0000">'/etc/main.js'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//etc..<br />&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">view</span><span style="color: #007700">(</span><span style="color: #DD0000">'page/index.php'</span><span style="color: #007700">,</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">&#125;&nbsp;</span>
</span>
</code></div>

<p>View: page/index.php</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">view</span><span style="color: #007700">(</span><span style="color: #DD0000">'layout/header.php'</span><span style="color: #007700">,</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br />...<br />&lt;</span><span style="color: #0000BB">b</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">main&nbsp;body&nbsp;html</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">b</span><span style="color: #007700">&gt;<br />...&nbsp;</span>
</span>
</code></div>

<p>View: layout/header.php</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">&lt;</span><span style="color: #0000BB">head</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">title</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">if(isset(</span><span style="color: #0000BB">$page_title</span><span style="color: #007700">))&nbsp;</span><span style="color: #0000BB">&#123;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$page_title</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">&#125;&nbsp;</span><span style="color: #007700">else&nbsp;</span><span style="color: #0000BB">&#123;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'&nbsp;Default&nbsp;Title&nbsp;'</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">&#125;&nbsp;?&gt;<br /></span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">title</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">&lt;?php&nbsp;<br /></span><span style="color: #007700">if(isset(</span><span style="color: #0000BB">$js_files</span><span style="color: #007700">)&nbsp;&amp;&amp;&nbsp;</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$js_files</span><span style="color: #007700">))&nbsp;</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">view</span><span style="color: #007700">(</span><span style="color: #DD0000">'layout/js_files.php'</span><span style="color: #007700">,</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">&#125;&nbsp;<br />?&gt;<br /></span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">head</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">body</span><span style="color: #007700">&gt;&nbsp;</span>
</span>
</code></div>

<p><br />
<b>Thank you for your time!</b></p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>bitauth live server won&#8217;t login</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/210884/" />      
      <id>tag:codeigniter.com,2012:forums/viewthread/.210884</id>
      <published>2012-02-12T12:24:20Z</published>
      <updated>0</updated>
      <author><name>fireport</name></author>
      <content type="html">
      <![CDATA[
        <p>I have been using bitauth locally and loggin and and setting up users fine.</p>

<p> I moved to a live server which has prrtty much the same configuration but am unable to log even with the default admin.</p>

<p>Any ideas on how to start a debug on this?i have checked the post values and they appear to be fine.</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>url wierdness</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/210874/" />      
      <id>tag:codeigniter.com,2012:forums/viewthread/.210874</id>
      <published>2012-02-12T00:08:03Z</published>
      <updated>0</updated>
      <author><name>joeizang</name></author>
      <content type="html">
      <![CDATA[
        <p>hey guys,</p>

<p>I have a funny thing that happens to my local setup for development. I have a form with action like so:</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">&lt;</span><span style="color: #0000BB">div&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">"entry"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">form&nbsp;action</span><span style="color: #007700">=</span><span style="color: #DD0000">"students/loginstudent"&nbsp;</span><span style="color: #0000BB">method</span><span style="color: #007700">=</span><span style="color: #DD0000">"POST"&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #DD0000">"studentlogin"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">label&nbsp;</span><span style="color: #007700">for=</span><span style="color: #DD0000">"Username"</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">strong</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Username&nbsp;</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">strong</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">input&nbsp;name</span><span style="color: #007700">=</span><span style="color: #DD0000">"user_name"&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #DD0000">"uname"&nbsp;</span><span style="color: #0000BB">type</span><span style="color: #007700">=</span><span style="color: #DD0000">"text"</span><span style="color: #007700">/&gt;&lt;/</span><span style="color: #0000BB">label</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">label&nbsp;</span><span style="color: #007700">for=</span><span style="color: #DD0000">"Password"</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">strong</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Password&nbsp;</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">strong</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">input&nbsp;name</span><span style="color: #007700">=</span><span style="color: #DD0000">"password"&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #DD0000">"password"&nbsp;</span><span style="color: #0000BB">type</span><span style="color: #007700">=</span><span style="color: #DD0000">"password"</span><span style="color: #007700">/&gt;&lt;/</span><span style="color: #0000BB">label</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">input&nbsp;name</span><span style="color: #007700">=</span><span style="color: #DD0000">"submitbtn"&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #DD0000">"logbtn"&nbsp;</span><span style="color: #0000BB">type</span><span style="color: #007700">=</span><span style="color: #DD0000">"submit"&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">=</span><span style="color: #DD0000">"Login"</span><span style="color: #007700">/&gt;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">form</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'&lt;p&nbsp;class="errors"&gt;&lt;strong&gt;'</span><span style="color: #007700">.</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ion_auth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">errors</span><span style="color: #007700">().</span><span style="color: #DD0000">'&lt;/strong&gt;&lt;/p&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;p&nbsp;class="errors"&gt;&lt;strong&gt;'</span><span style="color: #007700">.</span><span style="color: #0000BB">validation_errors</span><span style="color: #007700">().</span><span style="color: #DD0000">'&lt;/strong&gt;&lt;/p&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">?&gt;&nbsp;</span>
</span>
</code></div>

<p>and I have a function in my students controller called loginstudent. Now when I try to login I am brought back to the login form again but the url says this:</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">http</span><span style="color: #007700">:</span><span style="color: #FF8000">//localhost:8888/schoolmanager/index.php/students/students/loginstudent&nbsp;</span>
</span>
</code></div>

<p>so my question is has anyone encountered this before? I thought of sharing this here first as I think this is the best place to start finding answers.</p>

<p>Thanks for all the help!!!</p>

<p><img src="http://ellislab.com/images/smileys/question.gif" width="19" height="19" alt="question" style="border:0;" />:)</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Extending controller with function</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/210872/" />      
      <id>tag:codeigniter.com,2012:forums/viewthread/.210872</id>
      <published>2012-02-11T21:58:58Z</published>
      <updated>0</updated>
      <author><name>Hallas</name></author>
      <content type="html">
      <![CDATA[
        <p>Hello All !</p>

<p>Im a noob in codeigniter an started to work with it, everything seems to be ok till I had to implement function that will reside in almost all controllers and it has a task to log in mySQL some actions that user did.</p>

<p>So, my question is how can I include function that will do some logging action after model returns success, in almost every controller that I have ?</p>

<p><br />
Kind Regards,<br />
Robert</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Check Box&#63;</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/210712/" />      
      <id>tag:codeigniter.com,2012:forums/viewthread/.210712</id>
      <published>2012-02-09T21:35:45Z</published>
      <updated>2012-02-09T21:49:34Z</updated>
      <author><name>yepwingtim</name></author>
      <content type="html">
      <![CDATA[
        <p>please delete</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>pagination and uri_segment</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/210676/" />      
      <id>tag:codeigniter.com,2012:forums/viewthread/.210676</id>
      <published>2012-02-09T12:01:58Z</published>
      <updated>0</updated>
      <author><name>fanch</name></author>
      <content type="html">
      <![CDATA[
        <p>Hello!</p>

<p>i&#8217;m too new to CI to prentend having ancounter a bug. There&#8217;s must be a mistake in my code! I&#8217;ve read documentation and browsed forums but i can&#8217;t find where!</p>

<p>Any help is welcome:</p>

<p>I want to a simple pagination with sorting features. Here is the code:</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">Projects&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">CI_controller&nbsp;&#123;<br /><br />&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">display</span><span style="color: #007700">(</span><span style="color: #0000BB">$sort_by&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'id'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$sort_order</span><span style="color: #007700">=</span><span style="color: #DD0000">'desc'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$offset&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">&#123;<br /><br />&nbsp;&nbsp;$limits&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">30</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">model</span><span style="color: #007700">(</span><span style="color: #DD0000">'project_model'</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$results&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">project_model</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">search</span><span style="color: #007700">(</span><span style="color: #0000BB">$limits</span><span style="color: #007700">,</span><span style="color: #0000BB">$offset</span><span style="color: #007700">,</span><span style="color: #0000BB">$sort_by</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$sort_order</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$data&#91;</span><span style="color: #DD0000">'projects'</span><span style="color: #0000BB">&#93;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$results&#91;</span><span style="color: #DD0000">'rows'</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$data&#91;</span><span style="color: #DD0000">'num_results'</span><span style="color: #0000BB">&#93;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$results&#91;</span><span style="color: #DD0000">'num_rows'</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;</span><span style="color: #FF8000">//pagination<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">library</span><span style="color: #007700">(</span><span style="color: #DD0000">'pagination'</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$config&nbsp;</span><span style="color: #007700">=&nbsp;array();<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$config&#91;</span><span style="color: #DD0000">'base_url'</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">=</span><span style="color: #0000BB">site_url</span><span style="color: #007700">(</span><span style="color: #DD0000">"projects/display/</span><span style="color: #0000BB">$sort_by</span><span style="color: #DD0000">/</span><span style="color: #0000BB">$sort_order</span><span style="color: #DD0000">/</span><span style="color: #0000BB">$offset</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$config&#91;</span><span style="color: #DD0000">'total_rows'</span><span style="color: #0000BB">&#93;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$data&#91;</span><span style="color: #DD0000">'num_results'</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$config&#91;</span><span style="color: #DD0000">'per_page'</span><span style="color: #0000BB">&#93;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$limits</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$config&#91;</span><span style="color: #DD0000">'uri_segment'</span><span style="color: #0000BB">&#93;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">pagination</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">initialize</span><span style="color: #007700">(</span><span style="color: #0000BB">$config</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$data&#91;</span><span style="color: #DD0000">'pagination'</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">pagination</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">create_links</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">view</span><span style="color: #007700">(</span><span style="color: #DD0000">'projects'</span><span style="color: #007700">,</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br /><br />&#125;<br />?&gt;&nbsp;</span>
</span>
</code></div>

<p>The search function works great, i can type url such like:</p><blockquote>
<p><a href="http://10.153.9.6/dev/index.php/projects/display/id/desc">http://10.153.9.6/dev/index.php/projects/display/id/desc</a><br />
<a href="http://10.153.9.6/dev/index.php/projects/display/id/desc/10">http://10.153.9.6/dev/index.php/projects/display/id/desc/10</a><br />
<a href="http://10.153.9.6/dev/index.php/projects/display/counrty/asc/400">http://10.153.9.6/dev/index.php/projects/display/counrty/asc/400</a><br />
<a href="http://10.153.9.6/dev/index.php/projects/display/name/asc/11">http://10.153.9.6/dev/index.php/projects/display/name/asc/11</a></p>
</blockquote>

<p>But the pagination links are wrong, I obtain:</p><blockquote>
<p><a href="http://10.153.9.6/dev/index.php/projects/display/id/desc">http://10.153.9.6/dev/index.php/projects/display/id/desc</a><b>/0/240</b></p>
</blockquote>
<p>instead of:</p><blockquote>
<p><a href="http://10.153.9.6/dev/index.php/projects/display/id/desc">http://10.153.9.6/dev/index.php/projects/display/id/desc</a><b>/240</b></p>
</blockquote>
<p>I thought the problem was in the &#8220;uri_segment&#8217;, but I think 5 is the correct value:</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #FF8000">//&nbsp;base&nbsp;url&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;3/&nbsp;4&nbsp;&nbsp;/&nbsp;5<br /></span><span style="color: #0000BB">http</span><span style="color: #007700">:</span><span style="color: #FF8000">//10.153.9.6/dev/index.php/projects/display/id/desc/240&nbsp;</span>
</span>
</code></div>

<p>I&#8217;ve missed something. Any idea?</p>

<p>thanks!</p>

<p>fanch</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>is_unique is not working&#63;</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/210666/" />      
      <id>tag:codeigniter.com,2012:forums/viewthread/.210666</id>
      <published>2012-02-09T08:25:13Z</published>
      <updated>2012-02-09T08:56:41Z</updated>
      <author><name>DevBG</name></author>
      <content type="html">
      <![CDATA[
        <p>Hello, <br />
I am using CI 2.0.0 and validate function is_unique is not working.<br />
This is code my register users controller:</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">registration</span><span style="color: #007700">()<br />&nbsp;</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">library</span><span style="color: #007700">(</span><span style="color: #DD0000">'form_validation'</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">database</span><span style="color: #007700">();&nbsp;<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">form_validation</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set_rules</span><span style="color: #007700">(</span><span style="color: #DD0000">'email_address'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Email'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'is_unique&#91;users.email&#93;|required|valid_email'</span><span style="color: #007700">);<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">form_validation</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set_rules</span><span style="color: #007700">(</span><span style="color: #DD0000">'user_name'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'User&nbsp;Name'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'trim|required|min_length&#91;4&#93;|xss_clean'</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">form_validation</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set_rules</span><span style="color: #007700">(</span><span style="color: #DD0000">'password'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Password'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'trim|required|min_length&#91;4&#93;|max_length&#91;32&#93;'</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">form_validation</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set_rules</span><span style="color: #007700">(</span><span style="color: #DD0000">'con_password'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Password&nbsp;Confirmation'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'trim|required|matches&#91;password&#93;'</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;if(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">form_validation</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">run</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">FALSE</span><span style="color: #007700">)<br />&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">index</span><span style="color: #007700">();<br />&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;</span><span style="color: #007700">else<br />&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">user_model</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add_user</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">thank</span><span style="color: #007700">();<br />&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br />&nbsp;&#125;&nbsp;</span>
</span>
</code></div>
<p>This is views for register forms:</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">&lt;</span><span style="color: #0000BB">div&nbsp;id</span><span style="color: #007700">=</span><span style="color: #DD0000">"content"</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">div&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">"signup_wrap"</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">div&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">"signin_form"</span><span style="color: #007700">&gt;<br />&nbsp;</span><span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">form_open</span><span style="color: #007700">(</span><span style="color: #DD0000">"user/login"</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">?&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">label&nbsp;</span><span style="color: #007700">for=</span><span style="color: #DD0000">"email"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Е</span><span style="color: #007700">-</span><span style="color: #0000BB">майл</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">label</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">input&nbsp;type</span><span style="color: #007700">=</span><span style="color: #DD0000">"text"&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #DD0000">"email"&nbsp;</span><span style="color: #0000BB">name</span><span style="color: #007700">=</span><span style="color: #DD0000">"email"&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">=</span><span style="color: #DD0000">""&nbsp;</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">label&nbsp;</span><span style="color: #007700">for=</span><span style="color: #DD0000">"pass"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Парола</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">label</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">input&nbsp;type</span><span style="color: #007700">=</span><span style="color: #DD0000">"password"&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #DD0000">"pass"&nbsp;</span><span style="color: #0000BB">name</span><span style="color: #007700">=</span><span style="color: #DD0000">"pass"&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">=</span><span style="color: #DD0000">""&nbsp;</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">input&nbsp;type</span><span style="color: #007700">=</span><span style="color: #DD0000">"submit"&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">""&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">=</span><span style="color: #DD0000">"Вход"&nbsp;</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">form_close</span><span style="color: #007700">();&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;&lt;!--&lt;</span><span style="color: #0000BB">div&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">"signin_form"</span><span style="color: #007700">&gt;--&gt;<br />&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;&lt;!--&lt;</span><span style="color: #0000BB">div&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">"signup_wrap"</span><span style="color: #007700">&gt;--&gt;<br />&lt;</span><span style="color: #0000BB">div&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">"reg_form"</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">div&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">"form_title"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Вход</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">div&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">"form_sub_title"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Регистрирай&nbsp;се&nbsp;безплатно&nbsp;сега</span><span style="color: #007700">!&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">validation_errors</span><span style="color: #007700">(</span><span style="color: #DD0000">'&lt;p&nbsp;class="error"&gt;'</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">?&gt;<br />&nbsp;&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">form_open</span><span style="color: #007700">(</span><span style="color: #DD0000">"user/registration"</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">?&gt;<br />&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">label&nbsp;</span><span style="color: #007700">for=</span><span style="color: #DD0000">"user_name"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Вашето&nbsp;име</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">label</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">input&nbsp;type</span><span style="color: #007700">=</span><span style="color: #DD0000">"text"&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #DD0000">"user_name"&nbsp;</span><span style="color: #0000BB">name</span><span style="color: #007700">=</span><span style="color: #DD0000">"user_name"&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">=</span><span style="color: #DD0000">"&lt;?php&nbsp;echo&nbsp;set_value('user_name');&nbsp;?&gt;"&nbsp;</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">label&nbsp;</span><span style="color: #007700">for=</span><span style="color: #DD0000">"email_address"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Вашия&nbsp;е</span><span style="color: #007700">-</span><span style="color: #0000BB">майл</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">label</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">input&nbsp;type</span><span style="color: #007700">=</span><span style="color: #DD0000">"text"&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #DD0000">"email_address"&nbsp;</span><span style="color: #0000BB">name</span><span style="color: #007700">=</span><span style="color: #DD0000">"email_address"&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">=</span><span style="color: #DD0000">"&lt;?php&nbsp;echo&nbsp;set_value('email_address');&nbsp;?&gt;"&nbsp;</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">label&nbsp;</span><span style="color: #007700">for=</span><span style="color: #DD0000">"password"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Парола</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">label</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">input&nbsp;type</span><span style="color: #007700">=</span><span style="color: #DD0000">"password"&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #DD0000">"password"&nbsp;</span><span style="color: #0000BB">name</span><span style="color: #007700">=</span><span style="color: #DD0000">"password"&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">=</span><span style="color: #DD0000">"&lt;?php&nbsp;echo&nbsp;set_value('password');&nbsp;?&gt;"&nbsp;</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">label&nbsp;</span><span style="color: #007700">for=</span><span style="color: #DD0000">"con_password"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Повтори&nbsp;паролата</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">label</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">input&nbsp;type</span><span style="color: #007700">=</span><span style="color: #DD0000">"password"&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #DD0000">"con_password"&nbsp;</span><span style="color: #0000BB">name</span><span style="color: #007700">=</span><span style="color: #DD0000">"con_password"&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">=</span><span style="color: #DD0000">"&lt;?php&nbsp;echo&nbsp;set_value('con_password');&nbsp;?&gt;"&nbsp;</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">input&nbsp;type</span><span style="color: #007700">=</span><span style="color: #DD0000">"submit"&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">"greenButton"&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">=</span><span style="color: #DD0000">"Изпрати"&nbsp;</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;</span><span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">form_close</span><span style="color: #007700">();&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;&lt;!--&lt;</span><span style="color: #0000BB">div&nbsp;</span><span style="color: #007700">class=</span><span style="color: #DD0000">"reg_form"</span><span style="color: #007700">&gt;--&gt;&nbsp;&nbsp;&nbsp;&nbsp;<br />&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;&lt;!--&lt;</span><span style="color: #0000BB">div&nbsp;id</span><span style="color: #007700">=</span><span style="color: #DD0000">"content"</span><span style="color: #007700">&gt;--&gt;&nbsp;</span>
</span>
</code></div>
<p>And this model:</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">add_user</span><span style="color: #007700">()<br />&nbsp;</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;$data</span><span style="color: #007700">=array(<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'name'</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">input</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">post</span><span style="color: #007700">(</span><span style="color: #DD0000">'user_name'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'email'</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">input</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">post</span><span style="color: #007700">(</span><span style="color: #DD0000">'email_address'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'password'</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">md5</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">input</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">post</span><span style="color: #007700">(</span><span style="color: #DD0000">'password'</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">db</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #DD0000">'users'</span><span style="color: #007700">,</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br />&nbsp;</span><span style="color: #0000BB">&#125;&nbsp;</span>
</span>
</code></div>
<p>Does anyone know where I could be wrong?<br />
Thank&#8217;s advance!</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Molchy Open Source Contribution to CI Community</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/210610/" />      
      <id>tag:codeigniter.com,2012:forums/viewthread/.210610</id>
      <published>2012-02-08T18:22:51Z</published>
      <updated>2012-02-08T18:25:55Z</updated>
      <author><name>Denis Molan</name></author>
      <content type="html">
      <![CDATA[
        <p><span style="font-size:16px;"><b>Follow me on BitBucket: </b></span><a href="https://bitbucket.org/Molchy">Molchy BitBucket</a></p>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<span style="font-size:16px;"><b>Projects:</b></span><br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<a href="https://bitbucket.org/Molchy/ndb-session-class-for-codeigniter/wiki/Home">NDB Session Class for Codeigniter - Version 2.0</a></p>

<p>Native Session makes good use of PHP’s native session handling abilities, but it does not allow the use of a database for session storage. <br />
Saving user session data into database is more secure on any type of hosting (Shared ... ). <br />
This library overwrites normal native sassion functions too save user data directly into database and gives us some extra functions over CI Session. </p>

<p><br />
<b>Last Update:</b> 08.02.2012 </p>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<a href="https://bitbucket.org/Molchy/iso-639-2-and-mysql/wiki/Home">ISO 639-2 Language Codes for MySQL - Version 1.0</a></p>

<p>Latest ISO 639-2 language codes which can be imported to MYSQL and used.</p>

<p>Also included Greasemonkey script which made job easyer to get all codes in MYSQL format,<br />
it will also help out in future updates if needet.</p>

<p><b>Last Update:</b> 08.02.2012 </p>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<span style="font-size:16px;"><b>Help and Support</b></span><br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
If any issues, mistakes or bugs report them on BitBucket or in this post&#8230;<br />
If any upgrade ideas post them in this post.</p>



<p>&nbsp;</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Problem with CI on subdomain and htaccess</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/210608/" />      
      <id>tag:codeigniter.com,2012:forums/viewthread/.210608</id>
      <published>2012-02-08T18:09:36Z</published>
      <updated>0</updated>
      <author><name>felix_</name></author>
      <content type="html">
      <![CDATA[
        <p>Hey,<br />
I&#8217;m trying to set up a CI installation on a subdomain.<br />
I&#8217;ve got some troubles with rewriting the url to the correct location :/<br />
Here are more details: <a href="http://stackoverflow.com/questions/9197763/codeigniter-on-subdomain-and-htaccess">http://stackoverflow.com/questions/9197763/codeigniter-on-subdomain-and-htaccess</a></p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Admin for more than one site&#63;</title>
      <link rel="alternate" type="text/html" href="http://codeigniter.com/forums/viewthread/210552/" />      
      <id>tag:codeigniter.com,2012:forums/viewthread/.210552</id>
      <published>2012-02-08T05:40:20Z</published>
      <updated>0</updated>
      <author><name>rudejason</name></author>
      <content type="html">
      <![CDATA[
        <p>Hope I am putting this question in the right place.</p>

<p>As some of you know I have been working on several websites for one client. Now I am building an admin system for them to handle all the site. I have seen several posts where you can switch config or database files by using the domain your on. I am not able to do that. The admin will be on one domain. All the sites are hosted on the same server so I am able to connect to all the databases from one domain.</p>

<p>They all have the same database structure just different data.</p>

<p>There are 4 total databases.</p>

<p>main &lt;&#8212;holds the users and other internal stuff<br />
site1<br />
site2<br />
site3</p>

<p>in my database.php file &#40;config folder&#41; I have set up 4 groups</p>

<p>default (main)<br />
site1<br />
site2<br />
site3</p>

<p>Here is how it is working so far.</p>

<p>User goes to the admin, the default / main database loads.<br />
During login the code checks to see what the last site was they were working on and sets a session var using set_userdata with that value.</p>

<p>Now logged in, the user sees a select menu with the current site (set in the session from the main db on login)</p>

<p>When they change the selector to a different site, i use ajax to change the session var and update the db. Doing so i use</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">db</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">();&nbsp;</span>
</span>
</code></div>
<p>and it is working fine.</p>

<p>The page reloads and the new selection shows and the session var is set to the new site / database.</p>

<p>Now on the pages where i pull information / edit / add etc.. i use the following code</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">$editdb&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">session</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">userdata</span><span style="color: #007700">(</span><span style="color: #DD0000">'editdb'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$CI&nbsp;</span><span style="color: #007700">=&amp;&nbsp;</span><span style="color: #0000BB">get_instance</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">$editdb&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">database</span><span style="color: #007700">(</span><span style="color: #0000BB">$editdb</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">TRUE</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">$editdb&nbsp;</span><span style="color: #007700">=&amp;&nbsp;</span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">$editdb</span><span style="color: #007700">;&nbsp;</span>
</span>
</code></div>

<p>Then to make the sql calls i use</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">$editdb</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">();&nbsp;</span>
</span>
</code></div>

<p>The issue comes when I want to use flash data. So say the user edits and item, well i want them to know the item was edited. <br />
So i set flash data like so</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">session</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set_flashdata</span><span style="color: #007700">(</span><span style="color: #DD0000">'msg'</span><span style="color: #007700">,</span><span style="color: #DD0000">'Update&nbsp;Success'</span><span style="color: #007700">);&nbsp;</span>
</span>
</code></div>
<p>I then use the redirect with refresh set.</p>

<p>On the next page i check for the flashdata like so</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">If(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">session</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">flashdata</span><span style="color: #007700">(</span><span style="color: #DD0000">'msg'</span><span style="color: #007700">))&nbsp;</span>
</span>
</code></div>

<p>But it never shows&#8230;</p>

<p>I am thinking it is because i have my sessions set to use the database. There are ways around it, i could use Cookies to pass the success or fail message but would like to keep everything consistent and well i seem to have no luck with the set cookie stuff in Codeigniter. My cookies never set&#8230;<br />
If i use the php method of setcookie they work fine.</p>

<p>So I am guessing that what ever site is selected, that is the database the sessions are set to.</p>

<p>Any ideas on how to get my flash data to work across all the sites / databases?</p>

<p>Should i store the session localy and not in the database?</p>

<p>It is not a big cookie, userid(int), name, user type (int), logged in, selected site.</p>

<p>Thanks in advance.</p>

<p>&nbsp;</p>
      ]]>
      </content>
    </entry>


</feed>
