Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource problem
I am a beggiinner when it cames to programming with php. At the moment I am working at a project with a database. A problem appears when I try to call my query: $r = mysqli_query($db, $q);
I get this error:
This is my class where I connect to my database:
class conectDB{
var $dbUser;
var $dbPassword;
var $dbHost;
var $dbName;
function __construct() {
$this->dbUser ='root';
$this->dbPassword = '';
$this->dbHost = 'localhost';
$this->dbName = 'db';
$dbc = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName) or die('Fatal error!');
}
}
And here I call my query:
$db = new conectDB();
$q='SELECT * FROM categories ORDER BY category';
$r = mysqli_query($db, $q);
while(list($id, $category) = mysqli_fetch_array($r, MYSQLI_NUM)){
echo '<li><a href="category.php?id='.$id.'" title="'.$category.'">'.$category.'</a></li>';
}