我对mysql查询有点问题。由于某种原因,我可以回显mysql查询中的所有相关行,但在查询之外它只返回最后一行。这是我的代码。有什么建议吗?
//Get all associated
$q=mysql_query("SELECT * FROM `ACCOUNT` WHERE ACCOUNT_ID='$act_id'");
while ($row = mysql_fetch_assoc($q)){
$act_name=$row['ACT_NAME'];
echo "$act_name<br>"; // This returns all rows fine
}
echo "$act_name<br>"; // This only return the last row. i would like to get all rows.