Re: server error or script error
| From: | Ross | Date: | Thu, 08 Mar 2007 09:19:54 +0000 |
| Subject: | Re: server error or script error | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250059@lists.php.net to get a copy of this message | ||
This script change does not make a difference. What could have been turned
on/off on the server to cause this?
I can output the binary to screen but I cannot create the pdf.
R.
""Flavien CHANTELOT"" <fchantelot@aliadis.com> wrote in message
news:6248BAF37534EC4086203ED217BEAA2307A627@ATLANTA.xi-lite.lan...
I guess the problem is here :
$query = "SELECT * FROM mypdfs WHERE id =$id";
Change it to :
$query = "SELECT * FROM mypdfs WHERE id =".$id;
-----Message d'origine-----
De : Ross [mailto:ross@aztechost.com]
Envoyé : jeudi 8 mars 2007 09:39
À : php-general@lists.php.net
Objet : [PHP] server error or script error
<?php
include ('../phpscripts/connect.php');
$id = $_GET['id'];
$query = "SELECT * FROM mypdfs WHERE id =$id";
$result= mysql_query($query) or die('Error, query failed');
if (!mysql_num_rows($result))
{
die("No matching records were found in the database.");
}
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$size=$row['pdf_size'];
$type=$row['pdf_type'];
$name=$row['pdf_name'];
$content=$row['content'];
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; $name; ");
echo $content;
}
?>
I use this script but is had sudenly stop working. I think it is a config
change on the remote server. The porblem is the file either doesn't open or
downloads as download.php
Can anyone suggest a way to improve this script or debug to fins out if it
is a script error or server error.
R.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php