View Album error within code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lsecrease
Forum Newbie
Posts: 3
Joined: Sun Oct 30, 2011 9:40 pm

View Album error within code

Post by lsecrease »

I've written code to view an album and I continue to get the following error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/pichurz/public_html/view_album.php on line 26

For some reason I cannot find the error. Is there something I'm missing? Here's the script:

view_album.php

Code: Select all

error_reporting (E_ALL ^ E_NOTICE);
session_start();
$user_id = $_SESSION['user_id'];
$email = $_SESSION['email'];
include 'connect.php';
include 'func/album.func.php';
include 'func/image.func.php';

if (!isset($_GET['album_id']) || empty($_GET['album_id']) || album_check($_GET['album_id']) === false) {
	header('Location: album.php');
	exit();
}

$album_id = $_GET['album_id'];
$album_data = album_data($album_id, 'name', 'description');

echo '<h3>', $album_data['name'], '</h3><p>', $album_data['description'], '</p>';

$images = get_images($album_id);

if (empty($images)) {
	echo 'There are no images in this album';
	} else {
	foreach ($images as $image) {
		echo '<a href="uploads/', $image['album'], '/', $image['id'], '.', $image['ext']'"><img src="uploads/thumbs/', $image['album'], '/', $image['id'], '.', $image['ext'], '" alt="" /></a> [<a href="delete_image.php?image_id=', $image['id'],'">x</a>]';
	}
}

lsecrease
Forum Newbie
Posts: 3
Joined: Sun Oct 30, 2011 9:40 pm

Re: View Album error within code

Post by lsecrease »

Line 26 is:

Code: Select all

echo '<a href="uploads/', $image['album'], '/', $image['id'], '.', $image['ext']'"><img src="uploads/thumbs/', $image['album'], '/', $image['id'], '.', $image['ext'], '" alt="" /></a> [<a href="delete_image.php?image_id=', $image['id'],'">x</a>]';
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: View Album error within code

Post by Celauran »

Looks like you forgot a concatenator.

Code: Select all

echo '<a href="uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '"><img src="uploads/thumbs/', $image['album'], '/', $image['id'], '.', $image['ext'], '" alt="" /></a> [<a href="delete_image.php?image_id=', $image['id'],'">x</a>]';
Post Reply