Jump to content

Recommended Posts

Hi, I've just turned my array into a 2 dimensional array, and it works great:

 

while ($row = mysql_fetch_assoc($result)) {
			$images_sub = array
    				(
       					'name' => $row['name'],
        				'description' => $row['description_' . $language],
    				);
   				$images[] = $images_sub;
		}

 

I'm now just struggling on how I'd now change my foreach loop to call the different variables:

 

foreach ($images as $image) {
	echo '<img src="$image['name']" alt="$image['description']" title="$image['description']" />';
}

 

Thanks in advance.

Oh god, yeah sorry it is! I'm not sure why it wasn't working for a minute there.

 

I don't suppose there's an easy way to only get the first set of values passed through the foreach loop, or get all but the first set of values?

 

Thanks, and sorry again.

i.e.

 

1. display $images[0] only in first foreach

2. display $images[1+] in second foreach (skip first values)

 

I need this as I'm putting the first set of values within different html from the rest (first image is displayed large, rest are thumbnails).

 

Thanks

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.