I am using php code to query to a database and the results will be used to generate a report.
If I want the report to be generated in a pdf format how should I do it
Look into html2pdf
Create your report as html and then run the code to transform into PDF. You don't need to know the language to generate the PDF blocks. Submitted forms work out cool too.