I have an image gallery where users will be uploading images from their phones into a database which then gets called onto my gallery page. Each entry has an ID, an image, and a description in the DB.
This is the code that exports the gallery:
//include database connection
include 'mysqlconnect.php';
$sql="select * from images order by image desc";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query))
{
$image=$row ['image'];
$description=$row ['description'];
//call all images from DB
echo '<a href="'.$image.'" title="'.$description.'" style="background-image:url('.$image.');"></a>';
}
The problem is when a user uploads photos with an iPhone. Because iPhones always save their images as "image.jpg", every time one is uploaded it overwrites the previous iPhone images in the gallery. I think this is because the gallery is only calling for file names.
Is there a way to call for the images based on their row ID? Something like $image=$row['id','image'];
?