The Mother Board

Motherboards.org forums. Free tech support, motherboard ID, and more.
It is currently Tue Dec 18, 2018 11:56 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed Dec 21, 2005 3:38 am 
Offline
Initiate
Initiate

Joined: Fri Jan 23, 2004 11:13 pm
Posts: 79
Hi,

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...
[php]
<?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++;
}
?>
[/php]

My table structure is the following:
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group