Welcome Guest, Not a member yet? Register   Sign In
SQL returns no data?
#1

[eluser]CoperNikus[/eluser]
If, for an example a
Code:
$this->db->query("SELECT * FROM ? WHERE id = ?");
doesn't match any data, what does it returns, I mean how do I check if it is empty?
#2

[eluser]CoperNikus[/eluser]
???
#3

[eluser]danmontgomery[/eluser]
Any successful query will return a result, if there is a database error it will return FALSE.

Code:
$query = $this->db->query("SELECT * FROM ? WHERE id = ?");
if($query == FALSE) {
  // Handle DB error
} else if($query->num_rows() == 0) {
  // Handle successful query with no records returned
} else {
  // Handle successful query with records returned
}




Theme © iAndrew 2016 - Forum software by © MyBB