Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 28th, 2005, 07:05 PM
Registered User
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parse error: parse error, unexpected $end

Can anyone pleas help me. I keep getting this error

Parse error: parse error, unexpected $end

when i try to run some php script and i cant seem to find a solution.

Please help. My code is shown below.

include 'config.inc.php';

// initialization
$photo_upload_fields = '';
$counter = 1;
$photo_category_list = '';

// If we want more fields, then use, preupload.php?number_of_fields=20
$number_of_fields = (isset($_GET['number_of_fields'])) ?
(int)($_GET['number_of_fields']) : 5;
// Firstly Lets build the Category List
$result = mysql_query('SELECT category_id,category_name FROM gallery_category');
while($row = mysql_fetch_array($result))
<option value="$row[0]">$row[1]</option>\n
mysql_free_result( $result );
// Lets build the Image Uploading fields
while($counter <= $number_of_fields)
Photo {$counter}:
<input name="photo_filename[]"
<textarea name="photo_caption[]" cols="30"
// Final Output

<title>Lets upload Photos</title>
<form enctype="multipart/form-data"
action="upload.php" method="post"
<table width="90%" border="0"
align="center" style="width: 90%;">
Select Category
<select name="category">
<!—Insert the image fields here -->
<input type="submit" name="submit"
value="Add Photos">


Old December 1st, 2005, 07:44 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul

This errors happens because:
You either left ; in your PHP lines.
Or you not nested conditionals { and } properly.

Now, please revise your PHP code.

Support Indian students' finances http://scholarship.mediasworks.com/
Old December 8th, 2006, 09:09 PM
Registered User
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Check to see that an errant single or double quote hasn't escaped a semi-colon.

Old January 12th, 2007, 12:21 PM
Registered User
Join Date: Jan 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I had this problem when I upgraded to PHP 5.2. The problem was caused by my used of the <? tag instead of <?php. I found the solution here http://www.mydigitallife.info/2006/0...nexpected-end/

In php.ini set
short_open_tag = On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected T_ELSE in /h vipin k varghese BOOK: XSLT Programmer's Reference, 2nd Edition 4 September 29th, 2011 01:19 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
PHP Parse error: parse error, unexpected T_STRING geminient PHP How-To 4 August 18th, 2007 02:27 AM
parse error, unexpected T_IF ajit_kunte BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 1 May 6th, 2005 09:27 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.