Code for downloading files in database seems to be not working because file downloaded are corrupted or damage.
This the code I used
if (isset($_GET['id']))
{
$id = $_GET['id'];
$query = "SELECT * FROM tbl_uploads WHERE fileid = '$id'";
$result = mysqli_query($connection,$query) or die('Error, query failed');
list($id, $file, $type, $size, $content) = mysqli_fetch_array($result);
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=".basename($file)."");
ob_clean();
flush();
$content = stripslashes($content);
echo $content;
}