我正在尝试获取mysql查询行,但是获取
致命错误:在布尔值上调用成员函数fetch_row()。
我在这里做错了什么?
$select="visitor_country";
$startDate="2016-01-01";
$endDate="2016-12-31";
$groupBy="visitor_country";
$query=$connection->prepare("SELECT ?, COUNT(*) as count FROM `analytics`.`analytics` WHERE date BETWEEN ? AND ? GROUP BY ? ORDER BY count");
$query->bind_param('ssss',$select,$startDate,$endDate,$select);
$query->execute();
$result=$query->store_result();
$row = $result->fetch_row();
$num_of_rows=count($row);
echo $num_of_rows."<br>";
$query->close();
$connection->close();
答案 0 :(得分:0)
这是答案
$query->bind_param('ssss',$select,$startDate,$endDate,$select);
$query->execute();
$result = $query->get_result();
$row = $result->fetch_row();
$num_of_rows=count($row);
echo $num_of_rows."<br>";
$query->close();
$connection->close();