<?php
include "config.php";
if(isset($_GET['id'])){
$id=$_GET['id'];
echo'$id';
$stat=$db->prepare("select * from contents where cid='$id'");
$stat->bindParam(1,$id);
$stat->execute();
$data=$stat->fetch();
$file='files/'.$data['document'];
if(file_exists($file)){
header('Content description: '.$data['document']);
header('Content-length'.filesize($file));
readfile($file);
exit;
}
}
?>
This is a script to download files from a phpmyadmin database (named contents)which contains the columns docid,cid,document,notification. When i execute this script i get the following error message:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at postmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log
I'm a complete beginner to both stack overflow as well as programming, so please forgive me if there is any error in my code or in my formatting of the question