Any idea how to fix this?
$dbo = JFactory::getDbo();
$query = 'SELECT `#__example`.`example_value` AS `value` FROM `#__example`';
$dbo->setQuery($query);
$rowsCount = $dbo->getNumRows();
$isEmpty = $rowsCount == 0;
echo $isEmpty;
I got
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given
in C:\server\www\libraries\joomla\database\driver\mysqli.php on line 343
and 1
in the response, while the table contains rows, so the result cannot be empty.
I just want to check whether the result set is empty without loading objects, etc... I load them in a later part of the code if it is not empty.