Jump to content

PHP website error


EyeOnYou

Recommended Posts

Hi here is error code:

Parse error: syntax error, unexpected $end in /customersites/0/home/httpd/vhosts/eyeonyouphotography.co.uk/httpdocs/galleries.php on line 172

 

Here is full code,part in bold is the only line i initially altered,before changing it back(or so I thought !) Appreciate the help.  :)

 

<html><head><title>General Photographers West Yorkshire</title>
<meta content="MSHTML 6.00.6001.18063" name="GENERATOR"/></head>
<body>
<html>

<META name="KEYWORDS" content="weddings,photographer, event,PR,photography,Yorkshire,,Wakefield,,Bradford,Leeds,Dewsbury ,photographer,wedding,quality, photographer,Mirfield,uk,">
<META name="DESCRIPTION" content="<p><b><u> am John Mather it is my intention is to photograph your special day in a style and manner that will give you lasting memories.Your wedding is important and so are you.">
<meta name="description" content="John Mather Photographer weddings/commercial<meta content="index,follow" name="robots"/>
<meta content="15" name="revisit-after"/>
<meta content="John Mather" name="author"/><link [b]href="http://eyeonyouphotography.co.uk/res/css/style.css" type="text/css" rel="stylesheet"/><?php require_once 'res/include/menu.php';   ?>[/b]

<div align="center">
<table class="main_table">
<tbody>
<tr>
<td>
<?
// Check that mode has been set, and if it had display the gallery
if (isset($_GET['mode'])){

// Display the index page, showing the different galleries
if ($_GET['mode']=='index'){
?>
<table class="main_table">
<tbody>
<tr>
<td>
<p class="title" align="left">Eye On You Photography - Galleries</p>
<p class="text">Please click on a link below to view a gallery:</p><?
//Display a random picture from the gallery
$query  = "SELECT * FROM category ORDER BY category ASC";
$result = mysql_query($query) or die('Error, query failed');

echo '<table width="100%" cellpadding="5" cellspacing="5" align="center">';

$colsPerRow = 4;

// width of each column in percent
$colWidth   = (int)(100/$colsPerRow);
$i = 0;
while ($row = mysql_fetch_assoc($result)) {
	if ($i % $colsPerRow == 0) {
		// start a new row
		echo '<tr>';
	}
   
echo 	'<td width="' . $colWidth . '%" align="center">' . 
	'<a href="http://www.eyeonyouphotography.co.uk/galleries.php?mode=gallery&category=' . $row['category'] . '">' . $row['title'] .'' .
      	'<p align="center"><img src="' . $row['image'] . '"/></p></a>';

   if ($i % $colsPerRow == $colsPerRow - 1) {
      // end this row
      echo '</td></tr>';
   }

   $i += 1;
}

// print blank columns
if ($i % $colsPerRow != 0) {
   while ($i++ % $colsPerRow != 0) {
      echo '<td width="' . $colWidth . '%"> </td>';
   }
   echo '</table></td></tr>';
}

echo '</tbody></table>'; 

?></td></tr></tbody></table><?
// Display the individual galleries and the pictures in them
} if($_GET['mode']=='gallery'){

$category = $_GET['category'];

$query  = "SELECT * FROM category WHERE category='$category'";
$result = mysql_query($query) or die('Error, query failed');
while ($row = mysql_fetch_assoc($result)) {
$text = $row['text'];
?>
<table class="main_table">
<tbody>
<tr>
<td>
<p class="title" align="left">Eye On You Photography - Galleries - <? echo $row['title']; ?></p>
<p class="text">
<div class="text"><? echo $row['description']; }?></div>
<?

$rowsPerPage = 20;

// by default we show first page
$pageNum = 1;

// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}

// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage; 

$query  = "SELECT * FROM pictures WHERE category='$category' ORDER BY id DESC LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed');

echo '<table width="100%" cellpadding="5" cellspacing="5" align="center">';

$colsPerRow = 4;

// width of each column in percent
$colWidth   = (int)(100/$colsPerRow);
$i = 0;
$count = 1;
while ($row = mysql_fetch_assoc($result)) {
	if ($i % $colsPerRow == 0) {
		// start a new row
		echo '<tr>';
	} 

echo 	'<td width="' . $colWidth . '%">' . 
	'<a href="http://www.eyeonyouphotography.co.uk/galleries.php?mode=picture&id=' . $row['id'] . '&category=' . $text . '" title="' . $row['title'] . '">' . 
	'<p align="center"><img src="' . $row['thumb'] . '" alt="' . $row['filename'] . '" title="' . $row['title'] . '" class="picture"/></p></a></td>';

$count = $count+1;

   if ($i % $colsPerRow == $colsPerRow - 1) {
      // end this row
      echo '</tr>';
   }

   $i += 1;
}

// print blank columns
if ($i % $colsPerRow != 0) {
   while ($i++ % $colsPerRow != 0) {
      echo '<td width="' . $colWidth . '%"> </td>';
   }
   echo '</table></p></td></tr>';
}

echo '</tbody></table>'; 

// how many rows we have in database
$query   = "SELECT * FROM pictures WHERE category='$category'";
$result  = mysql_query($query) or die('Error, query failed');
$numrows = mysql_num_rows($result);

// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);

// print the link to access each page
$self = $_SERVER['PHP_SELF'];

// creating previous and next link
if ($pageNum >1) { $page = $pageNum - 1; $prev = " <a href='$self?mode=gallery&category=$category&page=$page\"'>< Previous</a> "; } else { $prev = ' '; // we're on page one, don't print previous link 
} 

if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href='$self?mode=gallery&category=$category&page=$page\"'>Next ></a> "; } else { $next = ' '; // we're on the last page, don't print next link 
} // print the navigation link 
echo "<div align='\"center\"'>$prev $next </div>";
// Display the individual galleries and the pictures in them
} 
if($_GET['mode']=='picture'){

$id = $_GET['id'];

$category = $_GET['category'];

$query  = "SELECT * FROM pictures WHERE id='$id'";
$result = mysql_query($query) or die('Error, query failed');
while ($row 

 

(edited by kenrbnsn to surround code with


tags)

 

Link to comment
https://forums.phpfreaks.com/topic/152539-php-website-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.