I would like to have the PHP look up a document in a mysql table and then send out an http response. The response will later be used in a iPad app. the only response I get from this PHP to my app is: <>
Not helpful… Any ideas? Thanks so much!
<?
$username=$_GET['user'];
$password=$_GET['secret'];
$database="db";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$sql = "SELECT * FROM documents WHERE documentId='2'";
$result = mysql_query($sql);
dataT = @mysql_result($result, 0, "Document");
$name = @mysql_result($result, 0, "DocumentTitle");
$size = @mysql_result($result, 0, "DocumentSize");
$type = @mysql_result($result, 0, "DocumentType");
header("Content-type: $type");
header("Content-length: $size");
header("Content-Disposition: attachment; filename=$name");
header("Content-Description: PHP Generated Data");
header("Content-transfer-encoding: binary");
echo $dataT;
mysql_close();
?>
There is a $ in front of
missing.
Please activate all error reportings, i.e.
E_NOTICE– then you would see such errors yourself and early.