title: Codeigniter Controller function won't echo string
body: <p>I am trying to display a string when the code enters an if statement.</p>
  
  <p>I double checked and the code does go into the statement, but nothing prints.</p>
  
  <p>Here is my controller function:</p>
  
  <pre><code>public function clock_in()
  {
  
      $this-&gt;load-&gt;model('model_users');
  
  
         $this-&gt;db-&gt;where('USER_EMAIL', $this-&gt;session-&gt;userdata('USER_EMAIL'));
  
      $query = $this-&gt;db-&gt;get('clocked_in_users');
  
      if($query-&gt;num_rows() == 1){
  
  
  
           echo "Already Clocked in";
          exit;
  
      }else{
  
      $this-&gt;model_users-&gt;clock_user_in();
      };
  
  
  
      redirect('main/members');
  
  
  
  
  }
  </code></pre>
  
  <p>and my view:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;body&gt;
  
  &lt;div class="container"&gt;
  
      &lt;h1&gt;Members&lt;/h1&gt;
  
  
  
  
  
  
      &lt;?php
  
  
          echo "&lt;pre&gt;";
          print_r ($this-&gt;session-&gt;all_userdata()); //displays all user session data.
          echo "&lt;/pre&gt;";
  
          $this-&gt;load-&gt;helper('date');
  
          echo "&lt;h2&gt;";
  
          echo $date = date('Y-m-d H:i:s');
  
          echo "&lt;/h2&gt;";
  
      ?&gt;
  
  
      &lt;a href="&lt;?php echo 'clock_in'?&gt;"&gt;Clock In&lt;/a&gt;
  
      &lt;!-- clock in button --&gt;
  
         &lt;br /&gt;
      &lt;br /&gt;
  
        &lt;a href="&lt;?php echo 'clock_out'?&gt;"&gt;Clock Out&lt;/a&gt;
      &lt;br /&gt;        
      &lt;br /&gt;
      &lt;a href="&lt;?php echo 'main/logout'?&gt;"&gt;Logout&lt;/a&gt; &lt;!-- logout button. shit acts weird when you use it--&gt;
  
  
  
  
  &lt;/div&gt;
  
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm not sure what I am doing wrong. Every other echo in my controller will work find, but not this one. Any advice is appreciated. </p>
  
  <p>EDIT: Problem has been fixed, thanks to Arsalan. I had to add 
      exit;
   after the echo to make sure it displays before it reloads the members view</p>