0

img I have one row with images names like this , row_multiple_imgs['path_one,path_two,path_tree']; all are separate with comma how can I get this paths ? What i want to get is return 3 different paths I'm not sure that foreach loop can help; any solution to this ?

what I what get is thee different names from one row Independent from each other.

for example

foreach($row['multi_imag'] as img){
return $img;
}
Barmar
  • 741,623
  • 53
  • 500
  • 612
nskotow
  • 9
  • 4
  • I don't understand the question. Can you show the table schema (the output of `SHOW CREATE TABLE table_name`), some sample data, and the result you want? – Barmar Jan 24 '21 at 16:53
  • In general, `SELECT column1, column2, column3 FROM table_name WHERE ...` – Barmar Jan 24 '21 at 16:53
  • It's also generally poor DB design to put comma-separated values in a table column. See https://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad – Barmar Jan 24 '21 at 16:54
  • Okay i have one row with name : multi_images['imaga_name_one, image_name_two,image_name_three']; and inside this row i have three different paths . So i want return em as an individual part, as in associative array with different values – nskotow Jan 24 '21 at 16:58
  • That's what you wrote in the question. Saying it again doesn't clarify. Please click [Edit] and add more details to the question. – Barmar Jan 24 '21 at 16:59
  • now is better ? – nskotow Jan 24 '21 at 17:11
  • No. Can you show the table schema (the output of `SHOW CREATE TABLE table_name`), some sample data, and the result you want? – Barmar Jan 24 '21 at 17:12
  • as you can see in img i have row with 3 different paths – nskotow Jan 24 '21 at 17:13
  • 1
    `foreach (explode(',', $row['multi_imag']) as $img)`? – Barmar Jan 24 '21 at 17:13
  • Please post plain text, not images. And that image is so tiny it's unreadable. – Barmar Jan 24 '21 at 17:14
  • Yes this i want – nskotow Jan 24 '21 at 17:14
  • 1
    So what's the problem? If you have a comma-separated list, explode() should be the obvious solution. – Barmar Jan 24 '21 at 17:15

0 Answers0