title: Codeigniter show comments of deleted users
body: <p>The code below helps me to display all the comments (with user info) for particular post.</p>
  
  <p>When a user deactivates his account, I want his comments still be visible for other users but without displaying his info (such as name and city). I want to show default values instead.</p>
  
  <p>So I need to modify my code below so that it will check if user exists or not. If not, return default name and city values. </p>
  
  <p>I am trying to find a solution for several hours but cannot get the result I want. Could you please help me to solve the problem.</p>
  
  <pre><code>public function get_comments($post_id){
  
  $this-&gt;db-&gt;select('comments.comment_text, users.name,users.city');
  $this-&gt;db-&gt;from('comments','users');   
  $this-&gt;db-&gt;where('comments.post_id', $post_id);
  $this-&gt;db-&gt;join('users','comments.user_id = users.user_id');    
  
  $query = $this-&gt;db-&gt;get();
  
  if ($query &amp;&amp; $query-&gt;num_rows() &gt;= 1){
  return $query-&gt;result();
  }
  else {
  return false;
       }
  }
  </code></pre>