我有以下代码:
$query3 = "SELECT
Office,
COUNT(Office) As Tot_Part,
(SELECT COUNT(Office) FROM trespondent WHERE completion_status= 'Started' OR completion_status = 'Complete') As Total_Resp
FROM trespondent
WHERE completion_status <> 'New'
GROUP BY Office
ORDER BY Office";
$result3 = $mysqli->query($query3);
我正试图从mysql
转移到mysqli
并且正在努力奋斗。上面的语句只返回1
行,而不是应该存在的26
。欢迎任何指示。
答案 0 :(得分:2)
那是因为你只提取了一行($los = $result3->fetch_row();
)。
循环试试。
编辑:像这样:
$result3 = $mysqli->query($query3);
while($los = $result3->fetch_row())
{
print_r($los); /* sanity */
}