无法从我的mysql数据库下载文件

I'm trying to download file from MySQL server, but am not able to do so.

The script executes but it can download only the first 65 KB of the file.

<?php
    include('connect.php');
    if(isset($_GET['id']))
    {
        $id = $_GET['id'];
        $query = "SELECT * FROM upload WHERE id = '$id'";
        $result  = mysqli_query($connection,$query) or die(mysql_error());
        while($row = mysqli_fetch_assoc($result))
        {
            $name=$row['name'];
            $size=$row['size'];
            $type=$row['type'];
            $content=$row['content'];
        }
        header("Content-disposition: attachment; filename=$name");
        header("Content-length: $size");
        header("Content-type: $type");
        echo $content;
    } else {
        die("No file id given...");
    }
    unset($_GET['id']);
?> 

You're misusing content-length. It needs to be the size of what you transmit.

You want something like this:

header( "Content-length: " . count( content) );