weird problem php mssql
| From: | Davide | Date: | Wed, 12 Jan 2005 07:02:05 +0000 |
| Subject: | weird problem php mssql | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-25289@lists.php.net to get a copy of this message | ||
Hi,
I've strange problem with a blob field in a mssql db containing a ms word document:
<?php
$conn = mssql_connect('hostname','xxxxx','yyyyy');
mssql_select_db ('docs');
$i_result=mssql_query('Select * from documenti_file where file_esercizio_doc = 2004 and file_id_doc = 200');
$ar_row = mssql_fetch_array ( $i_result);
echo $ar_row[7];
$file = fopen('test.doc','wb');
fwrite($file,$ar_row[7]);
fclose($file);
mssql_free_result($i_result);
echo "<br>". strlen($ar_row[7]);
?>
works ok using my box as server (apache 1.3.29 and php 4.3.4 - win xp) and I can read the written file with ms-word; now the strange thing:
running same script on another server (apache 1.3.28 and php 4.3.4 win nt) I got the same result on the screen (echo), but the file written is corrupt and it shows weird things when opened with ms-word. It seems like data got corrupted in the write() task. File size is exactely the same. Database used is the same and resides on a third box. I've the same mssql client dll on the two boxes (ntwdblib.dll ver. 2000.80.194.0)
Any idea ?