Neil Thompson
asked on
pulling a BLOB from SQL2k works with Java but corrupts with PHP
Hi
I'm pulling back some data with Java and all works fine yet I want to move from Java to PHP and have mimicked the requirements with all working well except the PDF files that are created simply give the message "There was an error opening this document. The file is damaged and could not be repaired"
Any idea's what I'm doing wrong? as I say if I use the same code (but ported to Java) it works fine?
I've attachec the code below and a copy of the created pdf (just amended extension to .txt)
Thanks
Neil
I'm pulling back some data with Java and all works fine yet I want to move from Java to PHP and have mimicked the requirements with all working well except the PDF files that are created simply give the message "There was an error opening this document. The file is damaged and could not be repaired"
Any idea's what I'm doing wrong? as I say if I use the same code (but ported to Java) it works fine?
I've attachec the code below and a copy of the created pdf (just amended extension to .txt)
Thanks
Neil
<?php
header("Content-Type: application/pdf");
$docPath = "" . $_GET['from'];
$server="####";
$username="####";
$password="####";
$db = "####";
$sqlconnect=mssql_connect($server, $username, $password);
$sqldb=mssql_select_db($db,$sqlconnect);
$sql="SELECT c_content"
. "\n FROM ####.####.t_cadsdoc"
. "\n WHERE c_reference = '" . mysql_escape_string( $docPath ) . "'"
;
$results = mssql_query($sql);
$row=mssql_fetch_array($results);
mssql_close($sqlconnect);
echo $row['c_content'];
?>
buildPDF.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Apologies for delay in grading, just back from hols
Neil
Neil
ASKER