954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to store multiple image paths in MySQL

Hi guys,

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

Thank you
OCBPHOTO

ocbphoto
Newbie Poster
24 posts since Aug 2008
Reputation Points: 10
Solved Threads: 1
 

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

Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
 

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

ocbphoto
Newbie Poster
24 posts since Aug 2008
Reputation Points: 10
Solved Threads: 1
 

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.

Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
 

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

Dhanyavaad Shanti

ocbphoto
Newbie Poster
24 posts since Aug 2008
Reputation Points: 10
Solved Threads: 1
 

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

Dhanyavaad Shanti


Shukriya...
So cool...

Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You