public function getNumRows($key, $value, $table = null) { $table = $table ?: $this->tableName; $sql = "SELECT * FROM {$table} WHERE {$key}='{$value}'"; return $this->query($sql)->num_rows; }