Example using a mysql database
// Get all the images out of the database
$result = mysql_query ("SELECT * FROM tablewithimages")
or die ("Invalid query.");
// Determine the number of images that have been retrieved
$num_rows = mysql_num_rows($result);
// Start for-loop
for ($i=0; $i==$num_rows; $i++)
{
// Read next row from $result
$row = mysql_fetch_array($result);
// Retrieve image stored in this $row
$image = $row[ image ];
}
Hope this is what you mean.