0

Hi guys,

How can i store multiple image paths in one single MySQL field, help please

Thank you
OCBPHOTO

2
Contributors
5
Replies
8
Views
9 Years
Discussion Span
Last Post by Shanti C
0

You can store them with comma separated...
And retrieve them with implode and explode functions...
And tel me , by which reason you are trying to store multiple image paths into single field...

0

thank you shanti,

Well i have 3 products but each product has different colors

- Product1 (red,blue,yellow)
- Product2 (red,blue,silver,orange)
- Product3 (red,blue,black)

so i have the pic for each MAIN product, displaying right but i have this little boxes with the other pics next to it and i want the user to be able to click on those little boxes with the different pics in their colors so when they click on it the MAIN pic will change

i end it up doing for each color a field in my table :( i would like to know if is possible to have,

i.e. product

MySQL Table:
Products

Fields:
Main_Pic
Product1.jpg

colors_pic
Product1_red.jpg, Product1_blue.jpg, Product1_yellow.jpg


sorry for my lingo i am a young programmer

0

yes, save colors_pic with comma separated...and retrieve them appropriately...
see:

The implode() function takes an already existing array as
it's argument, and concatenates the contents of
each element in the array into a string.

where as explode() function performs reverse to implode()
function. It splits the string into items by a
delimiter, such as a dash, ampersand, space and places each
item into a new array.

0

thank you so much for your time, really i appreciate.

Dhanyavaad Shanti

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.