Welcome Guest, Not a member yet? Register   Sign In
Query with Null Result
#7

[eluser]behdesign[/eluser]
[quote author="lenwood" date="1272315467"]Thanks to all for your replies. I followed Armchair Samurai's example and that took care of it.

This raises another question for me. Can anyone explain when this is needed?

Code:
$query = $this->db->get();

if($query->num_rows() > 0) {
  foreach ($query->result() as $row) {
    $data[] = $row;
  }
  return $data;
}
[/quote]

You'd only use that if you wanted to do more with $row than just stick it in an array. As it is, however, you could just
Code:
return $query->result_array();
and get the same result.


Messages In This Thread
Query with Null Result - by El Forum - 04-25-2010, 09:10 PM
Query with Null Result - by El Forum - 04-25-2010, 09:24 PM
Query with Null Result - by El Forum - 04-25-2010, 09:28 PM
Query with Null Result - by El Forum - 04-26-2010, 01:18 AM
Query with Null Result - by El Forum - 04-26-2010, 09:57 AM
Query with Null Result - by El Forum - 04-26-2010, 10:29 AM
Query with Null Result - by El Forum - 04-26-2010, 12:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB