title: Check it is empty or not in codeigniter
body: <p>I am working in codeigniter.I have created one function in model.The function is like this : </p>
  
  <pre><code>function pr($id)
      {
          //$query5 = $this-&gt;db-&gt;query("select max(to_date) as last_date from agent_print_details where agent_id = ".$id);
          //$result5 = $query5-&gt;result();
  
          $this-&gt;db-&gt;select('max(to_date) as last_date');
          $this-&gt;db-&gt;from('agent_print_details');
          $this-&gt;db-&gt;where('agent_id',$id);
  
          $result = $this-&gt;db-&gt;get();
  
          if($result-&gt;num_rows()&gt;0)
  
          return $result-&gt;result();
  
          else
  
          return "empty";
  
      }
  </code></pre>
  
  <p>my controller is : </p>
  
  <pre><code>$pr_detail = $this-&gt;cashier1_model-&gt;pr($role['id']);
  
  if($pr_detail != 0)
  {
      echo "nisarg";
  }
  else
  {
      echo "123";
  }
  </code></pre>
  
  <p>when I print pr_detail then it will display output like this:</p>
  
  <pre><code>Array ( [0] =&gt; stdClass Object ( [last_date] =&gt; ) ) 
  </code></pre>
  
  <p>it will give blank data so it has to print <strong>123</strong> but it is display <strong>nisarg</strong>. </p>
  
  <p>So What should i have to do to print <strong>123</strong>?</p>