2012-08-31 19 views
0

我有一組AMFPHP服務從Flex應用程序接收包含圖像的bytearray。到現在爲止還挺好。現在我需要將字節數組寫入SQL Server數據庫中的blob字段。我正在使用MSSQL庫,我無法改變它。我怎樣才能做到這一點?使用MSSQL將PHP中的Blob編寫到SQL Server中

+0

什麼代碼做你現在在PHP中的字節數組? – mimicocotopus

回答

1

解決方案如下圖:

// Stores bytearray received from a Flex app through AMPPHP 

$arrData = unpack("H*hex", $image->data); 
$content = "0x".$arrData['hex']; 

$sql = "insert into Images (Id, ImageData) values ($id, $content)"; 
mssql_query($sql); 
相關問題