Don't know exactly what you mean, but here's what I think you want:
PHP Code:
<?php
require('includes/dbinfo.php');
mysql_connect($host, $username, $password) or die(mysql_error()) ;
mysql_select_db($db_name) or die(mysql_error()) ;
$data = mysql_query("SELECT * FROM image_bank") or die(mysql_error());
// Start the counter off at 1 (the first image)
$counter = 1;
while($info = mysql_fetch_array( $data )) {
echo "<img src=\"images_new/".$info['photo'] ."\" id=\"image_" . $counter . "\"/>";
// Increment the counter on each loop, for each new image
$counter++;
}
?>
This will output the images, with unique ids like so:
image_1
image_2
etc...
Let me know if you have any issues with this.
Bookmarks