public function numRows()
{
if (isset($this->statement)) {
$this->statement->store_result();
return $this->statement->num_rows;
} else {
if (isset($this->result)) {
return $this->result->num_rows;
} else {
throw new Exception('Error: The database result resource is not currently set.');
}
}
}