Hi guys,

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

Thank you
OCBPHOTO

Recommended Answers

All 5 Replies

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...

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

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.

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

Dhanyavaad Shanti

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

Dhanyavaad Shanti

Shukriya...
So cool...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.