I have an retrieving pdf from mysql. I have successfully retrieved the content of pdf from mysql but not able to display it on the website. Its giving me warning on header function I'm using to display it. Here is the code.
<?php ob_start(); //to get unique name $fileName = time().".pdf"; //to display as pdf header( "Content-type: application/pdf" ); header( "Content-disposition: attachment; filename=".$fileName ); echo $pdf; ob_end_flush(); ?>
but I'm constantly getting this error.
Warning: Cannot modify header information - headers already sent by (output started at C:\wamp64\www\SRFRS\Project-page.php:176) in C:\wamp64\www\SRFRS\Project-page.php on line 212
I have looked for many solutions online but nothing worked for me. If you could give me a solution or any other way to display pdf on my website.