june_c21 Posted November 14, 2007 Share Posted November 14, 2007 Current Result Expected Result Name Amount Total Name Amount Total A 15 40 A 15 A 15 40 A 15 A 10 40 A 10 40 how to edit this code into expected result ?? $query="SELECT user.acc_no, report.staff_no, user.name, report.amount FROM user,report WHERE report.staff_no = user.staff_no and status='approve' and user.bank ='Bumiputra Commerce Bank'" ; $result = mysql_query($query,$dblink); while($row = mysql_fetch_array($result)) { // $x_pos = $pdf->SetX(50); $y_pos = $pdf->GetY(); $pdf->SetX(40); $pdf->Cell(60,6,$row[0],1,0,'C',1); $pdf->Cell(50,6,$row[1],1,'C',0); $pdf->Cell(60,6,$row[2],1,'C',0); $pdf->Cell(20,6,$row[3],1,'C',0); $query1 = "SELECT SUM(amount) FROM report where staff_no = '$row[1]'and report.status='approve'"; $result1 = mysql_query($query1, $dblink); while($myrow1 = mysql_fetch_row($result1)) { $pdf->Cell(20,6,$myrow1[0],1,'C',0); $pdf->Ln(); } Quote Link to comment Share on other sites More sharing options...
gin Posted November 14, 2007 Share Posted November 14, 2007 Do an if to check if it's the last row. Use mysql_num_rows Quote Link to comment Share on other sites More sharing options...
june_c21 Posted November 14, 2007 Author Share Posted November 14, 2007 can you show me the code as i very new to php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.