PHP does have a
library to create PDF files, but I am not sure that all PHP installations have that library installed. It looks like your script would have 3 parts:
1) display selection form for information requested
2) retrieve the selected information from your mySQL database
3) format the selected information and print output to a new PDF file for viewing
I've not seen a script for that shared from other developers (and I've not really used much SQL) so I'm of little help here

I suggest you work on (1) and (2) with the output presented on the returned webpage, and when that is functional to your satisfaction, then work on adding (3) as an output option for the viewer.
Personally, I prefer to view websites (and queries to websites) in HTML as it is much faster to load and lower overhead. PDF is used to retain presentation fidelity across online and print, and should only be used where a typographical format must be preserved, otherwise HTML presentation is prefered.
Best regards,
Ken