for ($i=1; $i<=count($statustype); $i++) {
//$bgcolor = ($i%2==0)? "#1313AB" : "#179ECF";
$bgcolor = array("#0576FF","#FF0000","#00FF00");
for ($i=1; $i<=count($statustype); $i++) {
echo "
<center><table width='100%' border='0'>
<tr bgcolor='" . $bgcolor[$i] . "'>
<td width='2%'><center><b><font color='000000' font size='2' face='MS Sans Serif'>ลำดับ</font></b></center></td>
<td width='4%'><center><b><font color='000000' font size='2' face='MS Sans Serif'>วันที่</font></b></center></td>
<td width='3%'><center><b><font color=000000' font size='2' face='MS Sans Serif'>เวลา</font></b></center></td>
<td width='4%'><center><b><font color='000000' font size='2' face='MS Sans Serif'>เลขที่บิล</font></b></center></td>
<td width='5%'><center><b><font color='000000' font size='2' face='MS Sans Serif'>หมายเลขสมาชิก</font></b></center></td>
<td width='2%'><center><b><font color='000000' font size='2' face='MS Sans Serif'>จำนวน</font></b></center></td>
<td width='5%'><center><b><font color='000000' font size='2' face='MS Sans Serif'>ชื่อผู้เปิดบิลขาย</font></b></center></td>
<td width='5%'><center><b><font color='000000' font size='2' face='MS Sans Serif'>ชื่อผู้หยิบ</font></b></center></td>
<td width='6%'><center><b><font color='000000' font size='2' face='MS Sans Serif'>สถานะบิล</font></b></center></td>
<td width='5%'><center><b><font color='000000' font size='2' face='MS Sans Serif'>หมายเหตุ</font></b></center></td>
<td width='3%'><center><b><font color='000000' font size='2' face='MS Sans Serif'>ต้องการ</font></b></center></td>
</tr><br>";
$no=1;
$sql="select * from alai where status='$i' ";
$result=mysql_db_query($dbname,$sql);
$total=mysql_num_rows($result);
$sql="select * from alai where status='$i' order by date_today desc ";
$result=mysql_db_query($dbname,$sql);
while($r=mysql_fetch_array($result)) {
$id_status=$r[id_status];
$po_status=$r[po_status];
$number_status=$r[number_status];
$count_status=$r[count_status];
$fname_status=$r[fname_status];
$name_status=$r[name_status];
$status=$r[status];
$memo=$r[memo];