Reputation: 7058
I've recently created a PHP/MySQL while loop which fetches an array based on my parameters. From what I know about doing this, it should end when there are no more rows to grab. Mine just keeps going until I stop the page loading.
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']);
}
Upvotes: 2
Views: 1103
Reputation: 10214
try like this most likely the inline query is being rerun everytime you step through the while loop
$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']);
}
Upvotes: 8