我进行查询以在php中显示列类型为image
的图像。
但它没有显示任何内容。
附上代码并希望有人可以帮助我
$serverName = "localhost";
$uid = "sa";
$pwd = "d1mogodon";
$connectionInfo = array( "UID"=>$uid,
"PWD"=>$pwd,
"Database"=>"Imagen");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ){
echo "Unable to connect.</br>";
die( print_r( sqlsrv_errors(), true));
}
$fotoquery = "SELECT imagen FROM Imagen";
$stmt = sqlsrv_query( $conn, $fotoquery);
while($result = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC))
{
$image = $result['imagen'];
}
Header ("Content-type: image/jpeg");
echo $image;
sqlsrv_close($conn);