dear Sir/madam
I am getting a problem while displaying a image from database
Database : MSSQL2000
I have a table named “Image” having following fields as
I am using two PHP pages
First PHP page (list.php) as
[PHP]<?php
$errmsg = "";
if (! @mssql_connect( "10.147.16.167" ,"sa",""))
{
$errmsg = "Cannot connect to database";
}
@mssql_select_d b("epass");
$strSQL = "select * from Image";
$rsPix = mssql_query($st rSQL);
$numRows = mssql_num_rows( $rsPix);
$i = 0;
while($i < $numRows){
?>
<img src="pix.php?pi xID=<?php echo mssql_result($r sPix,$i,"pixID" ); ?>" width="100" height="100"/>
<?php
$i++;
}
?>
[/PHP]
Second PHP page as (pix.php)
[PHP]<?php
$errmsg = "";
if (! @mssql_connect( "10.147.16.167" ,"sa",""))
{
$errmsg = "Cannot connect to database";
}
@mssql_select_d b("epass");
if (IsSet($_GET['pixID'])){
//$gotten = @mssql_query("s elect Image from Image");
$gotten = @mssql_query("s elect Image from Image where ImageId = ".$_GET['pixID']);
header("Content-type: image/jpeg");
while ($row = mssql_fetch_arr ay($gotten))
{
echo "************** ";
print $row['Image'];
}
mssql_free_resu lt($gotten);
}
?>[/PHP]
Here I am running the list.php where an image box appears with cross button (no image is displaying in the image box)
It is kindly requested to see the problem. I will be very grateful to you guys
thanking you in anticipation
Brijesh
I am getting a problem while displaying a image from database
Database : MSSQL2000
I have a table named “Image” having following fields as
Code:
ImageId int Image Image FileType image/jpeg
First PHP page (list.php) as
[PHP]<?php
$errmsg = "";
if (! @mssql_connect( "10.147.16.167" ,"sa",""))
{
$errmsg = "Cannot connect to database";
}
@mssql_select_d b("epass");
$strSQL = "select * from Image";
$rsPix = mssql_query($st rSQL);
$numRows = mssql_num_rows( $rsPix);
$i = 0;
while($i < $numRows){
?>
<img src="pix.php?pi xID=<?php echo mssql_result($r sPix,$i,"pixID" ); ?>" width="100" height="100"/>
<?php
$i++;
}
?>
[/PHP]
Second PHP page as (pix.php)
[PHP]<?php
$errmsg = "";
if (! @mssql_connect( "10.147.16.167" ,"sa",""))
{
$errmsg = "Cannot connect to database";
}
@mssql_select_d b("epass");
if (IsSet($_GET['pixID'])){
//$gotten = @mssql_query("s elect Image from Image");
$gotten = @mssql_query("s elect Image from Image where ImageId = ".$_GET['pixID']);
header("Content-type: image/jpeg");
while ($row = mssql_fetch_arr ay($gotten))
{
echo "************** ";
print $row['Image'];
}
mssql_free_resu lt($gotten);
}
?>[/PHP]
Here I am running the list.php where an image box appears with cross button (no image is displaying in the image box)
It is kindly requested to see the problem. I will be very grateful to you guys
thanking you in anticipation
Brijesh
Comment