can anybody help me to reduce this code.
$dat= mysql_query
("SELECT wid,count(*) as count
FROM uptime
WHERE time_stamp>=DATE_SUB(NOW(),INTERVAL 10 MINUTE)
AND status<>200 GROUP BY wid ORDER BY time_stamp ASC"
);
while($ans= mysql_fetch_assoc($dat))
{
$count_array[]=$ans;
}
foreach ($count_array as $value)
{
if($value['count']==2)
{
$id=$value['wid'];
$add= mysql_query("SELECT email FROM website WHERE webid='".$id."'");
$result= mysql_fetch_assoc($add);
<--etc etc to send email-->
}
}
I need to reduce the code please help me.if the two queries can be combined without losing the meaning will also be helpful for me.