我最近创建了一个PHP / MySQL while循环,它根据我的参数获取数组。根据我所知道的,当没有更多行可以抓取时,它应该结束。我一直坚持下去,直到我停止加载页面。
while($row = mysql_fetch_array(mysql_query("SELECT username,password,title,message FROM notifications WHERE dateset = '$date'"))){
$test = new Boxcar($row['username'],$row['password']);
$test->send($row['title'],$row['message']);
}
答案 0 :(得分:8)
试试这样 每次进入while循环时,很可能都会重新运行内联查询
$result = mysql_query("SELECT username,password,title,message FROM notifications WHERE dateset = '$date'");
while($row = mysql_fetch_array($result)) {
$test = new Boxcar($row['username'],$row['password']);
$test->send($row['title'],$row['message']);
}