woolseyr Posted December 14, 2006 Share Posted December 14, 2006 Hi,what i have done was create a simple workorder script that will store all the entries into my database.Now what i am trying to do is have it out put to a pdf when i select the workorder that i want.So far all i can get it to do is out put the first entrie. I dont know what to put so that it will select the table entry other then the first one. I also want to try and be able to have it generate either just the report that i select or all of then depending on what area i click on. This is what i have for the pdf creation.[code]<?phpinclude ('db_connect.php');require('fpdf/fpdf.php');$sql = mysql_query("Select * From workorder ORDER BY work_order_num ") or die ("Sql error : " . mysql_error());if( mysql_num_rows($sql) > 0 ) {$row = mysql_fetch_array($sql);$printer_make = $row["printer_make"];$product_num = $row["product_num"];$location = $row["location"];$serial_number = $row["serial_number"];$date = $row["date"];$time_in = $row["time_in"];$time_out = $row["time_out"];$total_time = $row["total_time"];$reported_problem = $row["reported_problem"];$resolution = $row["resolution"];$problem_sum = $row["problem_sum"];$pt_description = $row["pt_description"];$pt_number = $row["pt_number"];$pt_qty = $row["pt_qty"];$milage = $row["milage"];$cost_parts = $row["cost_parts"];$cost_work = $row["cost_work"];$total = $row["total"];$work_order_num = $row["work_order_num"];$pdf=new FPDF();$pdf->AddPage();$pdf->SetFont('Helvetica','U',16);$pdf->Cell(80,10,'Work Order');$pdf->Ln(10);$pdf->SetFont('Helvetica','',12);$pdf->Cell(40,10,'Work Order Number:');$pdf->Cell(20,10, $work_order_num);$pdf->Ln(20);$pdf->Cell(30,10,'Printer Make:');$pdf->Cell(90,10, $printer_make);$pdf->Ln(10);$pdf->Cell(50,10,'Product Number:');$pdf->Cell(70,10, $product_num);$pdf->Ln(10);$pdf->Cell(20,10,'Location:');$pdf->Cell(80,10,$location);$pdf->Ln(10);$pdf->Cell(30,10,'Serial Number:');$pdf->Cell(80,10, $serial_number);$pdf->Ln(10);$pdf->Cell(25,10,'Date:');$pdf->Cell(70,10, $date);$pdf->Ln(6);$pdf->Cell(25,10,'Start Time:');$pdf->Cell(70,10, $time_in);$pdf->Ln(6);$pdf->Cell(25,10,'End Time:');$pdf->Cell(70,10, $time_out);$pdf->Ln(6);$pdf->Cell(25,10,'Total:');$pdf->Cell(70,10, $total_time);$pdf->Ln(20);$pdf->Cell(20,10,'Summary');$pdf->Cell(70,10, $problem_sum);$pdf->Ln(10);$pdf->Cell(20,10,'Problem Description');$pdf->Ln(8);$pdf->MultiCell(300,5, $reported_problem);$pdf->Ln(10);$pdf->Cell(20,10,'Resolution');$pdf->Ln(8);$pdf->MultiCell(300,5, $resolution);$pdf->Ln(10);$pdf->Cell(35,10,'Part Description:');$pdf->Cell(70,10, $pt_description);$pdf->Ln(6);$pdf->Cell(35,10,'Part Number:');$pdf->Cell(70,10, $pt_number);$pdf->Ln(6);$pdf->Cell(30,10,'Quantity:');$pdf->Cell(70,10, $pt_qty);$pdf->Ln(10);$pdf->Cell(30,10,'Milage');$pdf->Cell(70,10, $milage);$pdf->Ln(6);$pdf->Cell(30,10,'Cost of Parts:');$pdf->Cell(70,10, $cost_parts);$pdf->Ln(10);$pdf->Cell(30,10,'Cost of work:');$pdf->Cell(70,10, $cost_work);$pdf->Ln(6);$pdf->Cell(30,10,'Invoice Total:');$pdf->Cell(70,10, $total);$pdf->Output();}else {echo "No result for the query, PDF not generated";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/30640-selecting-the-right-row-for-output-to-pdf/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.