I have the following SQL query,
if ($conn) {
$resource = $mysqli->query('SELECT
catname
FROM
wp_categories
');
while ( $row = $resource->fetch_assoc() ) {
var_dump($row);
}
//var_dump($row);
}
else {
return false;
}
However this throws the error: "Call to a member function query() on a non-object".
This is something that appears commonly on here, but I can't see any issues this. Can anyone suggest what the issue might be?
Made and edit to the query.