title: if statement running regardless of true false
body: <p>I have tested each method individually with default values and it all seems to work.  There is something going on when they are all mixed together.</p>
  
  <p>Here is the code and i'll do my best to write it in an easy to follow way:</p>
  
  <p>Starting with the controller:</p>
  
  <pre><code>if ($active['newcliq']) 
              {   
                  $newcliqid = $this-&gt;create_m-&gt;create_keyword($cliq, $cliqid);
                  if (!$newcliqid) {
                  echo json_encode(array('success' =&gt; false));
                  } else {
                      $this-&gt;logic_m-&gt;change_active($newcliqid, $cliq);
                  }
              }
  </code></pre>
  
  <p><code>$active['newcliq']</code> is true or false and pulled from <code>userdata('active')</code></p>
  
  <p>Of course, the next thing it runs is <code>create_keyword($cliq, $cliqid)</code> seen below:</p>
  
  <pre><code>$this-&gt;db-&gt;insert('cliq', $insert); 
              $newcliqid = $this-&gt;db-&gt;insert_id();
              if ($newcliqid) {
                  return $newcliqid;
              } else {
                  return false;
              }
  </code></pre>
  
  <p>Again, I have checked it all manually, and I know that <code>$newcliqid</code> is returning the correct <code>insert_id</code>  and the overall function is returning the correct value.</p>
  
  <p>So <code>$newcliqid</code> is returned to the controller and goes runs <code>logic_m-&gt;change_active</code> seen below:</p>
  
  <pre><code>if (!$this-&gt;logic_m-&gt;cliqidcheck($cliqid)){
                  $cliqid = 6;
              }
  </code></pre>
  
  <p>The above line is what is giving me problems. No matter what value, <code>$cliqid</code> is ALWAYS set to 6.  Whether cliqidcheck returns true or false.  </p>
  
  <p>Here is <code>cliqidcheck($cliqid)</code></p>
  
  <pre><code>    public function cliqidcheck($cliqid)
      {
          if ((ctype_digit($cliqid)) AND ($this-&gt;checkcliqidexist($cliqid)))
          {
              return true;
          } else {
              return false;
          }
      }
  </code></pre>
  
  <p>I have tested cliqidcheck with manually entered values and it always returns the correct value.  In addition, i've flat out removed the cliqidcheck from the <code>change_active</code> model and it works perfectly.</p>
  
  <p>I also echo'ed the variable <code>$newcliqid</code> in the controller and found the correct value.</p>
  
  <p>I am hoping this is just a simple problem that I'm overlooking. Thanks for the help!  Please let me know if more info is required.  </p>