PHP Example
Screen shot
PHP Script to fetch images from database(save file as index.php)
<?php
$con=mysql_connect(\'localhost\',\'root\',\'\') or die(\"Mysql not connect\");
$database=mysql_select_db(\'test\',$con) or die(\"Database not connected\");
?>
<html>
<head>
<title>Fetch images from dataBase</title>
</head>
<body>
<?php
$i=0;
$query=\"select * from images\";
$result=mysql_query($query);
?>
<table border=\'1\'>
<tr>
<?php
while($data=mysql_fetch_array($result))
{
if($i%3==0)
{
?>
</tr><tr>
<td><img src=\"<?php echo \"upload/\".$data[\'image_name\']; ?>\" width=\"88\" height=\"96\"/></td>
<?php
}
else
{
?>
<td><img src=\"<?php echo \"upload/\".$data[\'image_name\']; ?>\" width=\"88\" height=\"96\"/></td>
<?php
}
$i++;
}
?>
</tr>
</table>
</body>
</html>

Mysql Database
--
-- Database: `test`
--

-- --------------------------------------------------------

--
-- Table structure for table `images`
--

CREATE TABLE IF NOT EXISTS `images` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `image_name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

--
-- Dumping data for table `images`
--

INSERT INTO `images` (`id`, `image_name`) VALUES
(1, \'1326847316img1.jpg\'),
(2, \'1326847323img2.jpg\'),
(3, \'1326848764img4.jpg\'),
(4, \'1326849875img3.jpg\'),
(5, \'1326849895img5.jpg\'),
(6, \'1326849902img6.jpg\'),
(7, \'1326849908img7.jpg\'),
(8, \'1326849915img8.jpg\'),
(9, \'1326849921img9.jpg\');

You can download source code here