我有以下 SQL 函数,并且我在 mysqli_stmt_bind_result 中删除了 $row。
//get the user number per month
public function chartwaitinguservsproduct(){
$stmt = mysqli_prepare($this->connection,
"select
(Select COUNT(*) from reusematching.waitinglist_product) as COUNTP,
(Select COUNT(*) from reusematching.waitinglist_user) as COUNTU;
");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_fetch($stmt);
mysqli_stmt_bind_result($stmt, $row->COUNTP, $row->COUNTU);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
}
但无论我如何更改数据库,$rows 始终为 NULL。为什么?因为 fetch 语句?