Reputation: 171
I have this code
while($row = $rs->fetch_object()){
echo $curl->get($row->site_url, 'sitekontrol', $row->id )."";
if($row->site_url == "changed") {
sendmail($mailadress);
}
}
this sent to many times. i want to send just once on complate result.
Upvotes: 0
Views: 677
Reputation: 1898
If you want to send the results once 10 sites change, you will have to keep track of this variable.
You may want to do something like this:
$changes = 0;
while($row = $rs->fetch_object() && $changes < 10){
echo $curl->get($row->site_url, 'sitekontrol', $row->id )."";
if($row->site_url == "changed") {
$changes++;
}
}
if($changes >= 10) {
sendmail($mailadress);
}
EDIT: Changed to Federico klez Culloca's solution.
Upvotes: 1