jtapoling Posted June 10, 2008 Share Posted June 10, 2008 Hello, I have the following string of images stored in a MySQL database that I want to display using PHP. Does anyone know how I can display the images individually? Here is the way that the images come from the database. I used the field name "picture" to identify the referrence in the database. http://api.cdmdata.m7z.net/ftproot/DealerFiles/3306/Photos/1B3EL46X15N649956-0.jpg,http://api.cdmdata.m7z.net/ftproot/DealerFiles/3306/Photos/1B3EL46X15N649956-1.jpg,http://api.cdmdata.m7z.net/ftproot/DealerFiles/3306/Photos/1B3EL46X15N649956-2.jpg,http://api.cdmdata.m7z.net/ftproot/DealerFiles/3306/Photos/1B3EL46X15N649956-3.jpg,http://api.cdmdata.m7z.net/ftproot/DealerFiles/3306/Photos/1B3EL46X15N649956-4.jpg,http://api.cdmdata.m7z.net/ftproot/DealerFiles/3306/Photos/1B3EL46X15N649956-5.jpg,http://api.cdmdata.m7z.net/ftproot/DealerFiles/3306/Photos/1B3EL46X15N649956-6.jpg,http://api.cdmdata.m7z.net/ftproot/DealerFiles/3306/Photos/1B3EL46X15N649956-7.jpg They are comma seperated and I know I need to seperate them by defining the (,) character as the seperating value but I cannot for the life of me remember how. Any help would be great. Thanks, Jeremy Quote Link to comment https://forums.phpfreaks.com/topic/109642-solved-display-string-of-images-from-mysql-database/ Share on other sites More sharing options...
jonsjava Posted June 10, 2008 Share Posted June 10, 2008 <?php $picture = explode(",", $row['picture']); foreach ($picture as $value){ print "<img src='$value'><br />\n"; } Quote Link to comment https://forums.phpfreaks.com/topic/109642-solved-display-string-of-images-from-mysql-database/#findComment-562527 Share on other sites More sharing options...
bluejay002 Posted June 11, 2008 Share Posted June 11, 2008 just a suggestion: given that the name of the images are not system generated and since ',' is a valid character for a filename, using ',' as a separator would cause some ruckus if ever the image filename has ','. i suggest to use other unique character or combination of characters to separate them then use jonsjava's suggestion for exploding text with the delimiter you come up with. Quote Link to comment https://forums.phpfreaks.com/topic/109642-solved-display-string-of-images-from-mysql-database/#findComment-562725 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.