Results 1 to 2 of 2

Thread: Assign Images to an Array

  1. #1
    Join Date
    Oct 2010
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Assign Images to an Array

    How would I assign images to an array.

    Here is my current array that I am working with

    PHP Code:
    $group = array("Web Site""E-Store""Advanced""Site Extras""Administration"); 
    Is there a way for me to say "instead of displaying the word "Web Site" display this image"?

    I have access to the MYSQL database where the array is defined - if that makes a difference.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Something like

    PHP Code:
    $figures = array("/thumbs/image1.jpg""/thumbs/image2.jpg""/thumbs/image3.jpg""/thumbs/image4.jpg""/thumbs/image5.jpg");

    foreach (
    $figures as $figure) {
        echo 
    '<img src="' $figure '" alt="Figure" />' "\n";

    should do it. More info http://php.net/manual/en/control-structures.foreach.php
    Corrections to my coding/thoughts welcome.

Tags for this Thread

Bookmarks

Posting Permissions

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