slimjim wrote:Could it because of the last }
which I forgot to add in here
...
The problem is that you are using this logic/flow:
select each DB row where [color=red]status = 1[/color]
loop on each DB row:
if [color=blue]rtzone = 0[/color]
select each DB row where [color=red]status = 1[/color] and [color=blue]rtzone = 0[/color] and rdate = $tdate
loop on each DB row
send email
end foreach
end if
end loop
I used red and blue colors above to show where things are being redundant (and as a side effect giving you a loop within a loop). Just get rid of this section (and closing "}" characters for the while loop and if block later on), and I think you'll have what you want:
$query2 = "SELECT rtzone FROM friends where status='1'";
$result2 = mysql_query($query2) or die( "ERROR: " . mysql_error() . "\n");
while ($myrow2 = mysql_fetch_array($result2)) {
$rtzone=$myrow2["rtzone"];
if($rtzone=="0"){