Looping Problem

Discussion in 'PHP' started by june_c21, Nov 14, 2007.

  1. #1
    i just want to know why my output result loop 3 times for each record? Please help. Appriciate that.


    $queryAA="SELECT staff_no from report ";
    $resultAA = mysql_query($queryAA,$dblink);
    while($rowAA = mysql_fetch_row($resultAA))
    {
    $query="SELECT user.acc_no, report.staff_no, user.name, report.amount FROM user LEFT JOIN report on report.staff_no= user.staff_no WHERE status ='approve'and user.bank='maybank'and user.staff_no= '$rowAA[0]'" ;
    // echo $query;
    $result = mysql_query($query,$dblink);
    while($row = mysql_fetch_row($result))
    {
    // $x_pos = $pdf->SetX(50);
    $y_pos = $pdf->GetY();
    $pdf->SetX(40);
    $pdf->Cell(50,6,$row[0],1,0,'C',1);
    $pdf->SetX(90);
    $pdf->Cell(40,6,$row[1],1,0,'C',0);
    $pdf->SetX(130);
    $pdf->Cell(80,6,$row[2],1,0,'C',0);
    $pdf->SetX(210);
    $pdf->Cell(20,6,$row[3],1,1,'C',0);
    }
    }
     
    june_c21, Nov 14, 2007 IP