0
데이터베이스에서 pdf 파일을 가져 오는 중 오류가 발생했습니다. 아래에 제 코드가 나와 있습니다. 내 코드를 검토하고 귀중한 제안을 보내주십시오. 그리고 출력을 열지 못했습니다. 문서. 제발 도와주세요.PHP에서 데이터베이스에서 PDF 파일 가져 오기
<?php
$server = 'localhost';
$user = 'root';
$pass = '';
$db = 'upload';
// Connect to Database
$connection = mysql_connect($server, $user, $pass) or die ("Could not connect to server ... \n" . mysql_error());
mysql_select_db($db) or die ("Could not connect to database ... \n" . mysql_error());
$id = intval($_GET['id']);
$file= 'SELECT `name`,`size`, `created`,`data` FROM `upload`';
$result = mysql_query($file);
if($d = mysql_fetch_array($result))
{
$file = $d['name'];
header('Content-type: application/pdf');
header("Content-Disposition: inline; name=".$row['name']);
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . size($file));
header('Accept-Ranges: bytes');
header("Location: $file");
@readfile($file);
}
else{
echo'No file with the specified ID exists';
}
?>
정의되지 않은 변수를 시도 할 것입니다 : D를 select.php에 라인 (14) 내가 좀 도와주십시오과 같은 오류가 점점 오전에. – sudha
두 번째 솔루션을 사용해 보셨습니까? 그것은 $ d를 지정/정의해야합니다. – infinigrove
다른 곳으로 직접가는 경우 .... – sudha