rohit mishra rohit mishra - 5 months ago 30
SQL Question

storing fpdf output in server and add filename in database

I am generating invoices using fpdf library which fetches data from database,now when the pdf is generated i want to save the file in a folder and add the file name with date in database so that i can fetch the all invoices generated previously in a table.Please help me out here.

Answer

Be shure that you can write to the directory.

$filename="/Mydirectory/bill01.pdf";

Save the Pdf.

$pdf->Output($filename,'F');

Update the Sql Tables

$query=" UPDATE `shopdb`.`bills` SET `bill_doc_crea` = '1', `bill_pdf_doc` = '".$filename."' WHERE `bills`.`ordernummer` ='".$orderId."' ;";