Re: server error or script error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/8/07, Ross <ross@xxxxxxxxxxxxx> wrote:

<?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.



Are you sure there isn't any data on the screen before you send the header?
and are you sure that all the vars coming from the database are correct
filled (content-type for example)

Tijnema

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux