0

I am fetching blob data (pdf) from my database but when i execute the code blank page is displayed. Maybe ahref tag is not working properly or the code has some issues or some syntax error please guide i am new to php.

<html>
    <head>
        <title>Download File From MySQL</title>
    </head>
    <body>
        <?php
            $con=mysqli_connect("localhost","root","","mydb");
            $query = "SELECT id, name FROM upload";
            $result = mysqli_query($con,$query) or die('Error, query failed');
            if(mysqli_num_rows($result) == 0) {
                echo "Database is empty <br>";
            } else {
                while(list($id, $name) = mysqli_fetch_array($result)) {
        ?>
                    <a href='download.php?id=<?php=$id;?>'><?php=$name;?></a> <br>
        <?php 
                }
            }
        ?>
    </body>
</html>
Jaydip kharvad
  • 1,064
  • 7
  • 13

0 Answers0