我收到此错误,有人可以帮我解决一下吗?
Fatal error: Call to a member function fetch_array() on boolean in /Applications/XAMPP/xamppfiles/htdocs/RECORD BREAKERS/includes/connection.php on line 33
这是代码
require_once("connection.php");
class genre
{
private $sGenreName;
private $iGenreID;
public function __construct()
{
$this->sGenreName=" ";
$this->iGenreID=0;
}
public function getGenre($sGenreID)
{
//make coonection
$oConnection = new Connection();
//create query
$sSQL = "SELECT GenreName,GenreID from tbgenres where GenreID=2";
//execute
$oResultSet=$oConnection->query($sSQL);
//fetch data
$aRow=$oConnection->fetchArray($oResultSet);
$aRow=$oConnection->fetchArray($oResultSet);
$this->sGenreName=$aRow["GenreName"];
$this->sGenreName=$aRow["GenreID"];
}
public function __get($var)
{
switch ($var) {
case 'GenreName':
return $this->sGenreName;
break;
case 'GenreID':
return $this->sGenreID;
break;
}
}
}
$g=new genre();
$g->getGenre(2);
echo $g;
?>