getting an image from mysql

admin

Administrator
Staff member
how do you pull an image from a database ?
i tried the following but it didn't work, is the a special call function ?
<?php
include("mydb.inc");
mysql_connect(localhost,$user,$password);

$database="employeeprofiles";
@mysql_select_db("$database") or die( "Unable to select database");

/*Search database for name*/
$table="employees";

$query="select * from $table group by id";

$result=mysql_query($query);

mysql_close();

/*Display Results*/

$num=mysql_numrows($result);

$i=0;
while ($i < $num) {

$name=mysql_result($result,$i,"name");
$position=mysql_result($result,$i,"position");
$ext=mysql_result($result,$i,"extention");
$phone=mysql_result($result,$i,"phone");
$image=mysql_result($result,$i,"image");
$id=mysql_result($result,$i,"id");

//Alternate row colors in our table
print ($i % 2) ? "<tr bgcolor=\"D7DEFF\">" : "<tr bgcolor=\"C2CCFF\">";

print "<td align=middle><b>$name</b></td><td align=middle><b>$position</b></td>";
print "<td align=middle><b>$ext</b></td><td align=middle><b>$phone</b></td>";
print "<td align=middle><b><center><img src=http://www.phpbuilder.com/board/archive/index.php/\$image\></b></td><td align=middle><a href='update_db.php?id=$id'><b>Update</b></a></td></tr><br>";

++$i;
}

?>




------------------
bl@cky
 
Back
Top