Link doesnt pick up id row

Hi i have a album gallery which when user click on an album displays the pictures within that album the link sort of… results on the url is
portfolio.php?albums=

but why it doesnt display the row ID which is meant to be like this
portfolio.php?albums=1

$gallery_html[] = '<a href=portfolio.php?albums='.$row['id'].'><img src="folder.gif" class="directory"><br />' .addslashes($list[$i]['album_name']). '</a><br />' .$delete_link. '</li>';

why is not picking up the the ID it picks up the portfolio.php?albums=

but its meant to be like
portfolio.php?albums=3
or anything depending on the ROW ID

<a href=portfolio.php?albums='.$row[‘id’].
but it doesnt

http://us.php.net/var_dump

what that and wher do i put that??

Try var_dump’ing the $row variable:


var_dump($row);

My guess is that the index id does not exist.

Hi the file file upload whenever i upload an image to main directory it saves one image into photos folder and copy another into thumbs folder but whenever i upload image to a different album (not main directory) it doesnt copy the other image to thumbs folder what i’m i doing wrong

this is the line that i chose the folder…

function make_locations ($locs)
{
	$html = '<select name="locations" class="input"><option value="0">-- Main Directory --</option>';
	foreach ($locs AS $key => $value)
	{
		$html .= '<option value="' .$value['album_id']. '">' .addslashes($value['album_name']). '</option>';
	}
	$html .= '</select>';

	return $html;
}

this is the whole code

<?php
/**
* create a sub album directory for photos
* to be stored in
*/
function create_album ($album_name, $sub_album = 0)
{
	global $db;

	$sql = "INSERT INTO " .ALBUMS_TABLE. "
		(
			album_name,
			sub_album
		)
		VALUES
		(
			'" .addslashes($album_name). "',
			" .intval($sub_album). "
		)";

	if ($db->query($sql))
	{
		return TRUE;
	}
	else
	{
		return FALSE;
	}
}

/**
* get a list of sub albums
*/
function get_albums ($sub_album = 0)
{
	global $db;

	$sql = "SELECT *
		FROM " .ALBUMS_TABLE. "
		WHERE sub_album = " .intval($sub_album);

	$db->query($sql);

	// initialise album storage
	$albums = array();
	while ($row = $db->fetch())
	{
		$albums[] = $row;
	}

	return $albums;
}

/**
* get a list of photos within an album
*/
function get_photos ($album = 0)
{
	global $db;

	$sql = "SELECT *
		FROM " .PHOTOS_TABLE. "
		WHERE album_id = " .intval($album). "
		ORDER BY photo_id ASC";

	$db->query($sql);

	// initialise album storage
	$photos = array();
	while ($row = $db->fetch())
	{
		$photos[] = $row;
	}

	return $photos;
}

/**
* get a large version of a particular photo
*/
function get_large ($photo, $album = 0, $next = '')
{
	global $db, $template, $account_details;

	// shall we get the next / previous photo
	switch ($next)
	{
		case "next" :

			$next_sql = "AND photo_id > " .intval($photo). " ORDER BY photo_id ASC";
			break;

		case "previous" :

			$next_sql = "AND photo_id < " .intval($photo). " ORDER BY photo_id DESC";
			break;

		default :

			$next_sql = "AND photo_id = " .intval($photo);
			break;
	}

	$sql = "SELECT *
		FROM " .PHOTOS_TABLE. "
		WHERE album_id = " .intval($album). "
		" .$next_sql. "
		LIMIT 1";

	$db->query($sql);
	if ($db->num_rows() == 0)
	{
		return '';
	}
	else
	{
		$photo_info = $db->fetch();

		// note the total directory
		$location = 'photos/' .$photo_info['photo_proper'];

		// now we need to resize
		list($width, $height) = getimagesize($location);
		if ($width < 300)
		{
			$new_width = $width;
			$new_height = $height;
		}
		elseif ($width > $height)
		{
			$new_width = 300;
			$new_height = $height * ($new_width / $width);
		}
		elseif ($width < $height)
		{
			$new_width = $width * ($new_height / $height);
			$new_height = 300;
		}

		// work out the next link
		$next = '<a href="portfolio.php?p=' .$photo_info['photo_id']. '&a=' .$photo_info['album_id']. '&next=next">Next</a>';
		$previous = '<a href="portfolio.php?p=' .$photo_info['photo_id']. '&a=' .$photo_info['album_id']. '&next=previous">Previous</a>';			

		return '<div id="largephoto"><img src="' .$location. '" height="' .$new_height. '" width="' .$new_width. '" class="large"><br /><div id="prevnext">' .$previous. ' :: ' .$next. '</div></div>';
	}
}

/**
* get an array of locations
*/
function get_locations ()
{
	global $db;

	// initialise array
	$locations = array();

	// select albums
	$sql = "SELECT

			album_id,
			album_name

		FROM " .ALBUMS_TABLE;

	$db->query($sql);
	while ($row = $db->fetch())
	{
		$locations[] = $row;
		
	}

	return $locations;
}

/**
* make the locations table
*/
function make_locations ($locs)
{
	$html = '<select name="locations" class="input"><option value="0">-- Main Directory --</option>';
	foreach ($locs AS $key => $value)
	{
		$html .= '<option value="' .$value['album_id']. '">' .addslashes($value['album_name']). '</option>';
	}
	$html .= '</select>';

	return $html;
}

/**
* delete an album from the database
* does not delete the photos in it
*/
function delete_albums ($album_ids)
{
	global $db;

	if (sizeof($album_ids) > 0)
	{
		$sql = "DELETE FROM " .ALBUMS_TABLE. "
			WHERE album_id IN (" .implode(',', $album_ids). ")";
	
		if ($db->query($sql))
		{
			return TRUE;
		}
	}

	return FALSE;
}

/**
* delete a set of photos
*/
function delete_photos ($photo_ids)
{
	global $db;

	if (sizeof($photo_ids) > 0)
	{
		// select photo names for deletion
		$sql = "SELECT photo_proper
			FROM " .PHOTOS_TABLE. "
			WHERE photo_id IN (" .implode(',', $photo_ids). ")";

		$db->query($sql);

		$unlink_ids = array();
		while ($row = $db->fetch())
		{
			$unlink_ids[] = $row['photo_proper'];
		}

		// now delete the photos
		if (sizeof($unlink_ids) > 0)
		{
			$sql = "DELETE FROM " .PHOTOS_TABLE. "
				WHERE photo_id IN (" .implode(',', $photo_ids). ")";
	
			if ($db->query($sql))
			{
				// remove photo from directory
				for ($i = 0; $i < sizeof($unlink_ids); $i++)
				{
					unlink("photos/" .$unlink_ids[$i]);
					unlink("photos/thumbs/" .$unlink_ids[$i]);
				}
				return TRUE;
			}
		}
	}

	return FALSE;
}

/**
* upload a set of files
*/
function upload_files ($save_dir = '', $album = 0)
{
	global $db;

	// check the save dir is writable
	if (!is_writable($save_dir))
	{
		return FALSE;
	}

	// specify allowed file types
	$allowed_types = array (
	
		'image/jpg',
		'image/jpeg',
		'image/pjpeg',
		'image/gif'
	
	);

	// keep a list of uploaded files
	$uploaded = array();

	// store bytes uploaded
	$total_bytes = 0;

	// go through the list of files
	while (list($key, $value) = each($_FILES['userfile']['name']))
	{
		// check file has been passed
		if (!empty($value))
		{
			// find extension
			$extension = substr($_FILES['userfile']['name'][$key], strpos($_FILES['userfile']['name'][$key],".") + 1);

			// time + $key for name
			$name = time(). "_" .$key. "." .$extension;

			// save url
			$add = $save_dir. "/" .$name;

			if (move_uploaded_file($_FILES['userfile']['tmp_name'][$key], $add))
			{
				chmod($add, 0777);

				// add photo to database
				create_photo($_FILES['userfile']['name'][$key], $name, $album);
			}
		}
	}

	return TRUE;
}

/**
* insert photo details into the database
*/
function create_photo ($photo_name, $key_name, $album = 0)
{
	global $db;

	// get the filesize
	if (!$size = filesize("photos/" .$key_name))
	{
		$size = 0;
	}

	// insert the photo in the database
	$sql = "INSERT INTO " .PHOTOS_TABLE. "
		(
			photo_name,
			photo_date,
			photo_proper,
			photo_size,
			album_id
		)
		VALUES
		(
			'" .addslashes($photo_name). "',
			" .time(). ",
			'" .addslashes($key_name). "',
			" .intval($size). ",
			" .$album. "
		)";

	if ($db->query($sql))
	{
		return TRUE;
	}
	else
	{
		return FALSE;
	}
}

/**
* get a complete raw copy of the directory
*/
function get_dir_contents ($dir)
{
	// declare content array
	$contents = array();

	// check gallery exists
	if (is_dir($dir))
	{
		if ($handle = opendir($dir))
		{
			while (FALSE !== ($file = readdir($handle)))
			{
				if ($file != '.' && $file != '..' && $file != 'thumbs')
				{
					if (file_exists($dir. '/thumbs/' .$file) || thumbnail($file, $dir. '/' .$file, $dir. '/thumbs'))
					{
						$contents[] = $dir. '/thumbs/' .$file;
					}
					else
					{
						$contents[] = 'no_image.gif';
					}
				}
			}
		}
	}

	return $contents;
}

/**
* create a thumbnail of a photo and store it
* in the thumbs directory
*/
function thumbnail ($filename, $source_file, $destination, $new_h = 75, $new_w = 75)
{
	if (!is_file($source_file))
	{
		return FALSE;
	}

	// get the image details
	list($old_w, $old_h, $type) = getimagesize($source_file);

	// create source image
	switch($type)
	{
		case 1:

			$source = @imagecreatefromgif($source_file);
			break;

		case 2:

			$source = @imagecreatefromjpeg($source_file);
			break;

		case 3:

			$source = @imagecreatefrompng($source_file);
			break;

		default :

			return FALSE;
	}

	// work out dimensions
	if ($old_w < $old_h)
	{
		$thumb_w = $new_w;
		$thumb_h = $old_h * ($new_h / $old_w);
	}
	elseif ($old_w > $old_h)
	{
		$thumb_w = $old_w * ($new_w / $old_h);
		$thumb_h = $new_h;
	}
	elseif ($old_w == $old_h)
	{
		$thumb_w = $new_w;
		$thumb_h = $new_h;
	}
	$thumb = @imagecreatetruecolor($thumb_w, $thumb_h);

	// create image
	imagecopyresized($thumb, $source, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_w, $old_h);

	// check we have a proper destination
	if (!is_dir($destination))
	{
		mkdir($destination, 0777);
	}

	// save image
	switch ($type)
	{
		case 1:
		case 2:

			imagejpeg($thumb, $destination. '/' .$filename);
			break;

		case 3:

			imagepng($thumb, $destination. '/' .$filename);
			break;
	}

	// memory saving
	imagedestroy($thumb);
	imagedestroy($source);

	// thumbnail created successfully
	return TRUE;
}

/**
* make the table to show the directories and photos
*/
function make_table ($list, $type, $row = 3)
{
	// initialize gallery html array
	$gallery_html = array();

	// check if we have a list > 0
	if ($size = sizeof($list))
	{
		switch ($type)
		{
			case "GALLERIES" :

				$gallery_html[] = '<div id="galleries">';
				break;

			case "PHOTOS" :
			case "RAW" :

				$gallery_html[] = '<div id="photos">';
				break;
		}

		// loop through list
		for ($i = 0; $i < sizeof($list); $i++)
		{
			// shall we open a new list
			if ($i % $row == 0)
			{
				$gallery_html[] = '<ul>';
			}

			// add to list
			switch ($type)
			{
				case "GALLERIES" :

					// create the delete link
					$delete_link = '';
					if ($_SESSION['logged_in'])
					{
						$delete_link = '[ <a href="admin.php?mode=deletealbum&a=' .$list[$i]['album_id']. '">Delete</a> ]';
					}

				
					$gallery_html[] = '<a href=portfolio.php?albums='.$list[$i]['album_id'].'><img src="folder.gif" class="directory"><br />' .addslashes($list[$i]['album_name']). '</a><br />' .$delete_link. '</li>';
					break;

				case "PHOTOS" :

					// construct photo name
					$name = $list[$i]['photo_proper'];

					// construct location
					$location = "photos/";

					// create thumbnail
					if (!file_exists($location. "/thumbs/" .$name))
					{
						thumbnail($name, $location. "/" .$name, $location. "/thumbs/");
					}

					// construct date
					$date = '<div class="date">' .date("d/m G:ia", $list[$i]['photo_date']). '</div>';

					// create the delete link
					$delete_link = '';
					if ($_SESSION['logged_in'])
					{
						$delete_link = '[ <a href="admin.php?mode=deletephoto&p=' .$list[$i]['photo_id']. '">Delete</a> ]';
					}

					// image information
					list($width, $height) = getimagesize($location . $list[$i]['photo_proper']);

					// add to the html
					$gallery_html[] = '<li><a href="' .$location . $list[$i]['photo_proper']. '" rel="lightbox[racing]" title="Photos"><img src="' .$location. "/thumbs/" .$name. '" class="picture"><br />View</a><br />' .$delete_link. '</li>';
					break;

				case "RAW" :

					$gallery_html[] = '<li><img src="' .$list[$i]. '" class="picture"></li>';
					break;
			}

			// shall we close the list
			if ( ($i + 1) % $row === 0 || ($i + 1) == $size)
			{
				$gallery_html[] = '</ul>';
			}
		}

		$gallery_html[] = '</div>';
	}

	return implode('', $gallery_html);
}
?>

THANNk you very much thank u thank u i spend the whole day trying evrything once again thank u its 6:26 am stayed up whole night thank nw i can go bed

As I already suspect the problem is your variable. Your variable is not the $row to be used but $list:


$gallery_html[] = '<a href=portfolio.php?albums='.$list[$i]['album_id'].'><img src="folder.gif" class="directory"><br />' .addslashes($list[$i]['album_name']). '</a><br />' .$delete_link. '</li>';

Hi
this is the whole code my only problem is on the link

<a href=portfolio.php?albums=‘.$row[‘id’].’>

has it only opens the portfolio.php?album=

when is meant to open portfolio.php?album=1 or 2 or 3

depending on the id row number

<?php
/**
* create a sub album directory for photos
* to be stored in
*/
function create_album ($album_name, $sub_album = 0)
{
	global $db;

	$sql = "INSERT INTO " .ALBUMS_TABLE. "
		(
			album_name,
			sub_album
		)
		VALUES
		(
			'" .addslashes($album_name). "',
			" .intval($sub_album). "
		)";

	if ($db->query($sql))
	{
		return TRUE;
	}
	else
	{
		return FALSE;
	}
}

/**
* get a list of sub albums
*/
function get_albums ($sub_album = 0)
{
	global $db;

	$sql = "SELECT *
		FROM " .ALBUMS_TABLE. "
		WHERE sub_album = " .intval($sub_album);

	$db->query($sql);

	// initialise album storage
	$albums = array();
	while ($row = $db->fetch())
	{
		$albums[] = $row;
	}

	return $albums;
}

/**
* get a list of photos within an album
*/
function get_photos ($album = 0)
{
	global $db;

	$sql = "SELECT *
		FROM " .PHOTOS_TABLE. "
		WHERE album_id = " .($album). "
		ORDER BY photo_id ASC";




	$db->query($sql);

	// initialise album storage
	$photos = array();
	while ($row = $db->fetch())
	{
		$photos[] = $row;
	}

	return $photos;
}

/**
* get a large version of a particular photo
*/
function get_large ($photo, $album = 0, $next = '')
{
	global $db, $template, $account_details;

	// shall we get the next / previous photo
	switch ($next)
	{
		case "next" :

			$next_sql = "AND photo_id > " .intval($photo). " ORDER BY photo_id ASC";
			break;

		case "previous" :

			$next_sql = "AND photo_id < " .intval($photo). " ORDER BY photo_id DESC";
			break;

		default :

			$next_sql = "AND photo_id = " .intval($photo);
			break;
	}

	$sql = "SELECT *
		FROM " .PHOTOS_TABLE. "
		WHERE album_id = " .intval($album). "
		" .$next_sql. "
		LIMIT 1";

	$db->query($sql);
	if ($db->num_rows() == 0)
	{
		return '';
	}
	else
	{
		$photo_info = $db->fetch();

		// note the total directory
		$location = 'photos/' .$photo_info['photo_proper'];

		// now we need to resize
		list($width, $height) = getimagesize($location);
		if ($width < 300)
		{
			$new_width = $width;
			$new_height = $height;
		}
		elseif ($width > $height)
		{
			$new_width = 300;
			$new_height = $height * ($new_width / $width);
		}
		elseif ($width < $height)
		{
			$new_width = $width * ($new_height / $height);
			$new_height = 300;
		}

		// work out the next link
		$next = '<a href="portfolio.php?p=' .$photo_info['photo_id']. '&a=' .$photo_info['album_id']. '&next=next">Next</a>';
		$previous = '<a href="portfolio.php?p=' .$photo_info['photo_id']. '&a=' .$photo_info['album_id']. '&next=previous">Previous</a>';			

		return '<div id="largephoto"><img src="' .$location. '" height="' .$new_height. '" width="' .$new_width. '" class="large"><br /><div id="prevnext">' .$previous. ' :: ' .$next. '</div></div>';
	}
}

/**
* get an array of locations
*/
function get_locations ()
{
	global $db;

	// initialise array
	$locations = array();

	// select albums
	$sql = "SELECT

			album_id,
			album_name

		FROM " .ALBUMS_TABLE;

	$db->query($sql);
	while ($row = $db->fetch())
	{
		$locations[] = $row;
		
	}

	return $locations;
}

/**
* make the locations table
*/
function make_locations ($locs)
{
	$html = '<select name="locations" class="input"><option value="0">-- Main Directory --</option>';
	foreach ($locs AS $key => $value)
	{
		$html .= '<option value="' .$value['album_id']. '">' .addslashes($value['album_name']). '</option>';
	}
	$html .= '</select>';

	return $html;
}

/**
* delete an album from the database
* does not delete the photos in it
*/
function delete_albums ($album_ids)
{
	global $db;

	if (sizeof($album_ids) > 0)
	{
		$sql = "DELETE FROM " .ALBUMS_TABLE. "
			WHERE album_id IN (" .implode(',', $album_ids). ")";
	
		if ($db->query($sql))
		{
			return TRUE;
		}
	}

	return FALSE;
}

/**
* delete a set of photos
*/
function delete_photos ($photo_ids)
{
	global $db;

	if (sizeof($photo_ids) > 0)
	{
		// select photo names for deletion
		$sql = "SELECT photo_proper
			FROM " .PHOTOS_TABLE. "
			WHERE photo_id IN (" .implode(',', $photo_ids). ")";

		$db->query($sql);

		$unlink_ids = array();
		while ($row = $db->fetch())
		{
			$unlink_ids[] = $row['photo_proper'];
		}

		// now delete the photos
		if (sizeof($unlink_ids) > 0)
		{
			$sql = "DELETE FROM " .PHOTOS_TABLE. "
				WHERE photo_id IN (" .implode(',', $photo_ids). ")";
	
			if ($db->query($sql))
			{
				// remove photo from directory
				for ($i = 0; $i < sizeof($unlink_ids); $i++)
				{
					unlink("photos/" .$unlink_ids[$i]);
					unlink("photos/thumbs/" .$unlink_ids[$i]);
				}
				return TRUE;
			}
		}
	}

	return FALSE;
}

/**
* upload a set of files
*/
function upload_files ($save_dir = '', $album = 0)
{
	global $db;

	// check the save dir is writable
	if (!is_writable($save_dir))
	{
		return FALSE;
	}

	// specify allowed file types
	$allowed_types = array (
	
		'image/jpg',
		'image/jpeg',
		'image/pjpeg',
		'image/gif'
	
	);

	// keep a list of uploaded files
	$uploaded = array();

	// store bytes uploaded
	$total_bytes = 0;

	// go through the list of files
	while (list($key, $value) = each($_FILES['userfile']['name']))
	{
		// check file has been passed
		if (!empty($value))
		{
			// find extension
			$extension = substr($_FILES['userfile']['name'][$key], strpos($_FILES['userfile']['name'][$key],".") + 1);

			// time + $key for name
			$name = time(). "_" .$key. "." .$extension;

			// save url
			$add = $save_dir. "/" .$name;

			if (move_uploaded_file($_FILES['userfile']['tmp_name'][$key], $add))
			{
				chmod($add, 0777);

				// add photo to database
				create_photo($_FILES['userfile']['name'][$key], $name, $album);
			}
		}
	}

	return TRUE;
}

/**
* insert photo details into the database
*/
function create_photo ($photo_name, $key_name, $album = 0)
{
	global $db;

	// get the filesize
	if (!$size = filesize("photos/" .$key_name))
	{
		$size = 0;
	}

	// insert the photo in the database
	$sql = "INSERT INTO " .PHOTOS_TABLE. "
		(
			photo_name,
			photo_date,
			photo_proper,
			photo_size,
			album_id
		)
		VALUES
		(
			'" .addslashes($photo_name). "',
			" .time(). ",
			'" .addslashes($key_name). "',
			" .intval($size). ",
			" .$album. "
		)";

	if ($db->query($sql))
	{
		return TRUE;
	}
	else
	{
		return FALSE;
	}
}

/**
* get a complete raw copy of the directory
*/
function get_dir_contents ($dir)
{
	// declare content array
	$contents = array();

	// check gallery exists
	if (is_dir($dir))
	{
		if ($handle = opendir($dir))
		{
			while (FALSE !== ($file = readdir($handle)))
			{
				if ($file != '.' && $file != '..' && $file != 'thumbs')
				{
					if (file_exists($dir. '/thumbs/' .$file) || thumbnail($file, $dir. '/' .$file, $dir. '/thumbs'))
					{
						$contents[] = $dir. '/thumbs/' .$file;
					}
					else
					{
						$contents[] = 'no_image.gif';
					}
				}
			}
		}
	}

	return $contents;
}

/**
* create a thumbnail of a photo and store it
* in the thumbs directory
*/
function thumbnail ($filename, $source_file, $destination, $new_h = 75, $new_w = 75)
{
	if (!is_file($source_file))
	{
		return FALSE;
	}

	// get the image details
	list($old_w, $old_h, $type) = getimagesize($source_file);

	// create source image
	switch($type)
	{
		case 1:

			$source = @imagecreatefromgif($source_file);
			break;

		case 2:

			$source = @imagecreatefromjpeg($source_file);
			break;

		case 3:

			$source = @imagecreatefrompng($source_file);
			break;

		default :

			return FALSE;
	}

	// work out dimensions
	if ($old_w < $old_h)
	{
		$thumb_w = $new_w;
		$thumb_h = $old_h * ($new_h / $old_w);
	}
	elseif ($old_w > $old_h)
	{
		$thumb_w = $old_w * ($new_w / $old_h);
		$thumb_h = $new_h;
	}
	elseif ($old_w == $old_h)
	{
		$thumb_w = $new_w;
		$thumb_h = $new_h;
	}
	$thumb = @imagecreatetruecolor($thumb_w, $thumb_h);

	// create image
	imagecopyresized($thumb, $source, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_w, $old_h);

	// check we have a proper destination
	if (!is_dir($destination))
	{
		mkdir($destination, 0777);
	}

	// save image
	switch ($type)
	{
		case 1:
		case 2:

			imagejpeg($thumb, $destination. '/' .$filename);
			break;

		case 3:

			imagepng($thumb, $destination. '/' .$filename);
			break;
	}

	// memory saving
	imagedestroy($thumb);
	imagedestroy($source);

	// thumbnail created successfully
	return TRUE;
}

/**
* make the table to show the directories and photos
*/
function make_table ($list, $type, $row = 3)
{
	// initialize gallery html array
	$gallery_html = array();

	// check if we have a list > 0
	if ($size = sizeof($list))
	{
		switch ($type)
		{
			case "GALLERIES" :

				$gallery_html[] = '<div id="galleries">';
				break;

			case "PHOTOS" :
			case "RAW" :

				$gallery_html[] = '<div id="photos">';
				break;
		}

		// loop through list
		for ($i = 0; $i < sizeof($list); $i++)
		{
			// shall we open a new list
			if ($i % $row == 0)
			{
				$gallery_html[] = '<ul>';
			}

			// add to list
			switch ($type)
			{
				case "GALLERIES" :

					// create the delete link
					$delete_link = '';
					if ($_SESSION['logged_in'])
					{
						$delete_link = '[ <a href="admin.php?mode=deletealbum&a=' .$list[$i]['album_id']. '">Delete</a> ]';
					}
					
	echo  '<a href=viewalbum.php?album='.$row['id'].'><img src="'. $row['cover'] . '  " width="100"  height="100 " /> <a/> ';

					$gallery_html[] = '<a href=portfolio.php?albums='.$row['id'].'><img src="folder.gif" class="directory"><br />' .addslashes($list[$i]['album_name']). '</a><br />' .$delete_link. '</li>';
					break;

				case "PHOTOS" :

					// construct photo name
					$name = $list[$i]['photo_proper'];

					// construct location
					$location = "photos/";

					// create thumbnail
					if (!file_exists($location. "/thumbs/" .$name))
					{
						thumbnail($name, $location. "/" .$name, $location. "/thumbs/");
					}

					// construct date
					$date = '<div class="date">' .date("d/m G:ia", $list[$i]['photo_date']). '</div>';

					// create the delete link
					$delete_link = '';
					if ($_SESSION['logged_in'])
					{
						$delete_link = '[ <a href="admin.php?mode=deletephoto&p=' .$list[$i]['photo_id']. '">Delete</a> ]';
					}

					// image information
					list($width, $height) = getimagesize($location . $list[$i]['photo_proper']);

					// add to the html
					$gallery_html[] = '<li><a href="' .$location . $list[$i]['photo_proper']. '" rel="lightbox[racing]" title="Photos"><img src="' .$location. "/thumbs/" .$name. '" class="picture"><br />View</a><br />' .$delete_link. '</li>';
					break;

				case "RAW" :

					$gallery_html[] = '<li><img src="' .$list[$i]. '" class="picture"></li>';
					break;
			}

			// shall we close the list
			if ( ($i + 1) % $row === 0 || ($i + 1) == $size)
			{
				$gallery_html[] = '</ul>';
			}
		}

		$gallery_html[] = '</div>';
	}

	return implode('', $gallery_html);
}
?>

Better show us the complete code then we can say what is wrong. There must be something with the variable $row which doesnt suppose to hold that required id. Is it in another variable?


$gallery_html[] = '<a href=portfolio.php?albums=' . $list[$i]['id'] . '><img src="folder.gif" class="directory"><br />' .addslashes($list[$i]['album_name']) . '</a><br />' .$delete_link. '</li>';