A
A
adrenalinruslan2018-04-03 11:42:14
PHP
adrenalinruslan, 2018-04-03 11:42:14

Split data from database?

Guys, I want to draw an image from the database through a loop. For example, there is an images table, it has id, name, image
And in image, write links to images separated by commas. Like this:
www.images.ru/images1.jpg , www.images.ru/images2.jpg , www.images.ru/images3.jpg
How to check? For example, there are 3 links to images, so you need to display 3 images, if there are 2 links, then 2 images, and so on. How to implement it. It is necessary to type them into an array, split them into parts and output through foreach? Or some other way

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2018-04-03
@adrenalinruslan

foreach (explode(',', $row['image']) as $image) {
    echo $image;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question