How can I get this to work?
class Database {
public $mysqli;
public function connect() {
$this->mysqli = new mysqli('localhost', 'root', '', 'hltv');
}
public function sqlQuery() {
if($rows = $this->mysqli->query("SELECT * FROM users")) {
echo $rows->numRows();
}
}
}
says,
Fatal error: Call to undefined method mysqli_result::numRows() in C:\xampp\htdocs\hltv_new\includes\database\config.php on line 18
There is no method numRows, so you can't call it.
echo $rows->num_rows;