title: retrieve logged in users events through codeigniter
body: <p>Controller:</p>
  
  <pre><code>public function searchevent() {
      $this-&gt;load-&gt;model("users_model");  
      $data["rows"] = $this-&gt;users_model-&gt;search_member_events();
      $this-&gt;load-&gt;view("search_view", $data);        
  }
  </code></pre>
  
  <p>Model: </p>
  
  <pre><code>public function search_member_events() {
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('users');
      $this-&gt;db-&gt;where('id', '$userid');
      $this-&gt;db-&gt;join('events', 'users.id = events.user_id');
      $q = $this-&gt;db-&gt;get();      
      if ( $q-&gt;num_rows() &gt; 0 ) {
          foreach ( $q-&gt;result() as $row ) {
              $data[] = $row;
          }
          return $data;
      }
  
  }
  </code></pre>
  
  <p>view:</p>
  
  <pre><code>&lt;div class="member_search_results"&gt;
     &lt;h2&gt;Your Events &lt;/h2&gt;
     &lt;?php if(isset($rows)) : foreach($rows as $r): ?&gt;
        &lt;div class="outer"&gt;
          &lt;div class='single_result'&gt;
             &lt;strong class='title'&gt;&lt;?php echo $r-&gt;title ?&gt;&lt;/strong&gt;
             &lt;div class="outer"&gt;
                 &lt;span class='start'&gt;&lt;strong&gt;Starts at:&lt;/strong&gt; &lt;?php echo $r-&gt;start ?&gt;&lt;/span&gt;
                 &lt;span class='end'&gt;&lt;strong&gt;Ends at:&lt;/strong&gt; &lt;?php echo $r-&gt;end ?&gt;&lt;/span&gt;
                 &lt;span class='time'&gt;&lt;strong&gt;Time:&lt;/strong&gt;&lt;?php echo $r-&gt;time ?&gt;&lt;/span&gt;               
             &lt;/div&gt;
             &lt;div class="outer"&gt;
                 &lt;span class='location'&gt;&lt;strong&gt;Location:&lt;/strong&gt;&lt;?php echo $r-&gt;location ?&gt;&lt;/span&gt;
             &lt;/div&gt;
             &lt;div class="outer"&gt;
                 &lt;span class='description'&gt;&lt;strong&gt;Details:&lt;/strong&gt;&lt;?php echo $r-&gt;description ?&gt;&lt;/span&gt;
             &lt;/div&gt;
          &lt;/div&gt;
          &lt;?php endforeach; ?&gt;
      &lt;?php else : ?&gt;
      &lt;h2&gt;You do no have any events yet, please &lt;?php echo anchor ("createevent", "Create Event") ?&gt;&lt;/h2&gt;
      &lt;?php endif; ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have two database table USERS and EVENTS. What i want is when user is logged in..all events of logged in user from EVENT table should display on users dashboard. right now it is displaying all events.</p>