我试图找到一种方法来获取使用Select
PHP 查询时获取的行数。
代码片段:
$conn = new mysqli("8.8.4.4", "reader", "youwishyouknew", "perf_test");
if($conn->connect_errno){
echo 'Failed to connect to Database: ('.$conn->connect_errno.') '.$conn->connect_error;
} else {
$query = 'SELECT score, date FROM tbl_runs WHERE client_id = '.$_POST['device'].' AND os_id = '.$_POST['os'].' AND test_id = '.$_POST['test'].' ORDER BY date ASC';
$results = $conn->prepare($query);
$results->execute();
$results->bind_results($test_score, $test_date);
while($results->fetch(){
$tests[0][] = $test_date;
$tests[1][] = $test_date;
}
}
这一切都很好。但是我很感兴趣,是否可以在不计算调用次数的情况下查看实际返回了多少结果fetch()
?