Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2010
    Posts
    31
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Need Urgent Help

    Hi guys, please help if you can, in a bit of a pinch at the moment.

    I have setup a basic CMS for a client, wherein she can upload products to a mysql DB, and then it spits them out on here product page.

    Heres my problem:

    With one portion of the product their is a swatch color option. I have check boxes setup for all the main colors. I got it to upload to the DB fine.

    BUT

    When I pull that data from the DB, for instance it might be

    Red, Green, Blue

    How can I make it so that rather than showing the word red it shows a picture of the swatch that I am referring to?

    I have all of the swatches on the server I just need to figure out a way to make it happen.

    Ive tried a variety of loops, exploded the array, just can't seem to figure it out.

    Need help asap, thanks for reading.

    If code helps

    Code:
    echo "<small>" . $data['colors'] . "</small><br />";
    That echoes out all of the colors that she checked when uploading a file, could be just black, could be blue orange red green etc. (Comma separated).

    I need to make it so that instead of showing up as black

    It shows up as a picture of the black swatch.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Please edit the subject, by following the directions at http://www.codingforums.com/postguide.htm
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Jan 2010
    Location
    In a dump
    Posts
    64
    Thanks
    9
    Thanked 2 Times in 2 Posts
    An easy and quick way would be to add another column to the colours table with the swatch image src in and then when loading the colours you could just display the image using the src from the database.
    The answer my friend is blowing in the wind...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •