Download and Install fpdf class from https://www.fpdf.org/
Keep a copy of fpdf.php file in the same directory
Keep the font directory inside in the same directory.
Use the SQL_dump.txt file to create student table in your MySQL database
Open config.php file to enter your MySQL login details.
Open index.php file to see the records in your browser ( Not PDF ).
Open index-pdf.php file to generate PDF document.
Open index1-pdf.php file to generate PDF document with link to breakup of marks.
Connecting database and executing Query
To manage data we have to connect to MySQL database and execute query to get our date. Here there are two ways to use PHP drivers to connect to MySQL and execute the functions for getting records.
You can download both the scripts inside the same Zip file. Inside MySQLI folder you can get same scripts with MySQLi connection. ( change the config.php file here also and place fpdf.php with font directory inside this folder)
Enhanced PDF Generation Script: Now Supports SQLite Database
Our PDF generation script has been upgraded to support SQLite database. By updating the config.php file, you can seamlessly switch the database connection from MySQL to SQLite. Additionally, the latest version includes create_table_sqlite.php inside the downloadable ZIP file, allowing you to create an SQLite database with a sample student table effortlessly. This enhancement provides more flexibility in managing student data while generating PDFs.
To include SQLite database support, additional files have been added. These allow the script to work with an SQLite database instead of MySQL.
SQLite Integration
create_table_sqlite.php : This script creates a sample SQLite database file my_student.db in the same location.
config.php : By updating this file, the script can be switched to use SQLite instead of MySQL.
With these modifications, you can easily run the script using an SQLite database without requiring a MySQL server.
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com
Manik
30-01-2019
Thanks for sharing example.
WE have used your code and we are using issue like not displaying the record in each row wise in the pdf based on your example.
Can you please help how to disaplay each record in separate in the PDF.