我有一个简单的连接查询,应该在循环中回显每个数组结果foreach
。数组不为空。打印数组计数有效——有 801 个结果。但是,实际上打印出上面或内部的行foreach
只打印第一个结果。任何帮助,将不胜感激。
$listQuery = "SELECT r.email_address
FROM wholesale_accounts a
LEFT JOIN wholesale_register r ON r.register_id = a.register_id
WHERE r.email_address != ''
ORDER BY r.email_address";
$listResult = mysql_query($listQuery);
//print_r($listResult); // prints (Resource ID #21)
//exit;
$rows = mysql_fetch_array($listResult, MYSQL_ASSOC);
$count = mysql_num_rows($listResult);
//print_r($count); // prints 801
print_r($rows); // only prints first email address
exit;
foreach($rows as $row) {
print_r($row); // prints email address
}