This question already has an answer here:
In a foreach loop I upload some photos and store their values into one variable seperated by a comma as below
$photos.=$file_name.",";
When the files are uploaded, in the DB it is saved as
01461135_1015205099943781_302247337_n.jpg,11534328_56640920111689_2120954548_n.jpg,2160948_470329406422631_1521154943_n.jpg,
please mind the ,
at the end.
My aim is to echo them later like below
<li>
<img src="images/car1.jpg" />
</li>
My question is how can I separate the pictures knowing that the comma is at the end of the filename?
</div>
I think you can explode
your string and create an array of your pictures name
$picture_array = explode(",", $string);
Now all picture names are avaiable in $picture_array
http://us2.php.net/manual/en/function.explode.php
Explode will help you.
A similar question has already been asked: How can I split a comma delimited string into an array in PHP?