I am have made a scipt that uploads images to a MySQL database with blob data type from PHP.
Now i am just wondering how i can retrieve the images and display them. I have managed to display One image, but when i try to display multiple images it just doesnt seem to work, and that where i have been stuck for a while now.
Here is the code...
Code: Select all
<?php
$modelName = "kathy";
$hostname = "localhost";
$username = "root";
$password = "";
$databaseName = "newwavemodels";
// Connect to database
$errmsg = "";
if (! mysql_connect($hostname,$username,$password))
{
$errmsg = "Cannot connect to database";
}
mysql_select_db($databaseName);
$result = mysql_query("select imgdata from pix");
$index = 0;
while($row = mysql_fetch_array($result))
{
header("Content-type: image/jpeg");
echo mysql_result($result, $index);
$index++;
}
?>CREATE TABLE `pix` (
`pid` varchar(11) default NULL,
`title` varchar(10) NOT NULL default '',
`imgdata` longblob,
`thumbImage` longblob,
PRIMARY KEY (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Thanks for any input
Chris Vicatou