I am facing this issue while executing my script. I am trying to execute a query, but it is showing me this error "mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given". Please find below script. I am using SugarCRM framework.
$query4 = $reportquery;
var_dump($query4);
$value4 = $db->query($query4);
var_dump($value4);
while($row = $value4->fetch_assoc()){
print_r($row);
}
$query4 is a string, but when I dump $value4, it gives me bool(false) result. When I dump $query4, it gives me this
string(292) "SELECT opportunities.amount AS 'Opportunity Amount',opportunities.probability AS 'Probability (%)',opportunities.name AS 'Opportunity Name', COUNT(*) AS 'TOTAL' FROM opportunities WHERE opportunities.deleted = 0 GROUP BY opportunities.amount LIMIT 0,15"
When I execute this query as it is in db directly, it works. But here it is giving me an error. Kindly guide me here.