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(); } Link to comment https://forums.phpfreaks.com/topic/77254-table-helpsss/ 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 Link to comment https://forums.phpfreaks.com/topic/77254-table-helpsss/#findComment-391124 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 Link to comment https://forums.phpfreaks.com/topic/77254-table-helpsss/#findComment-391127 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.