In Your Database:
Save:
//make a pdf
$pdf=new FPDF();
$pdf->AddPage();
//set pdf to savable type
$pdfcontent = $pdf->Output("", "S");
//save pdf to database
$mysqli=new mysqli("hostname", "username", "password", "database");
$stmt = $mysqli->prepare("INSERT INTO pdfs (pdf) VALUES (?)");
$stmt->bind_param('s', $pdfcontent);
$stmt->execute();
Retrieve:
$mysqli=new mysqli("hostname", "username", "password", "database");
$stmt = $mysqli->prepare("SELECT pdf FROM pdfs WHERE id = ?");
$stmt->bind_param('i',$id);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($pdfcontent);
while($stmt->fetch()){
header("Content-Length: " . strlen($pdfcontent) );
header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment; filename="WarriorDeals_Voucher_'.$number.'-'.$numIndex.'.pdf"');
header("Content-Transfer-Encoding: binary\n");
echo $pdfcontent;
}