Hey ..

I am having a problem when i try to pull an image that has been stored in 
MS SQL Server from displaying properly.  I know, its a waste of space to 
store the actual image in SQL, but this is the way it needs to be done to 
be compatible with some of the other systems.  Anyway, if you have any 
input at all as to what could be wrong, please let me know.  I will 
provide my system information and code below for your review.  Thanks.

Platform: Linux Redhat 9
PHP Version  4.3.1
FreeTDS 0.61 (used to connect to Microsoft SQL Server)
SQL Server 2000

Here is my code (except for connection information, of course)

<showpic.php>

<?
$eventid=$_GET[picid];

$dsource = "<SQL IP>";
$sqluser = "<Username>";
$sqlpass = "<Password>";
$catalog = "<Database>";

[EMAIL PROTECTED]($dsource,$sqluser,$sqlpass) or die("Could not connect 
to the database");
@mssql_select_db($catalog) or die ("invalid");

$getpic = mssql_query("select Picture from GetPics where Id='$eventid'") 
or die("Query is not achievable by SQL Server") or die("invalid");

while($rs=mssql_fetch_array($getpic))
    {

    header("Content-type: image/jpeg");
    $image=$rs["Picture"];
    print $image;
}

?>


The following is the tag inserted to my webpage:

<img src="showpic.php?picid=1">

Please let me know if you have any ideas, and if you dont, thanks for your 
help anyway. 

Chris
[EMAIL PROTECTED]

Reply via email to