Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To 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 June 21st, 2010, 07:11 PM
Authorized User
 
Join Date: Dec 2009
Posts: 13
Thanks: 6
Thanked 0 Times in 0 Posts
Default PHP Parse Error -- HELP

o.k....I'm about to pull my hair out trying to debug this error(at least 4 hours now)!

Here is the error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\PHP\image_window.php on line 23

Line 23 in red below.

This code is from a text book, other than the directory path referred to in line 23. HERE IS THE CODE:

Code:
 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en">
<head>
   <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
   <title>View Image</title>
</head>
<body>
<?php # image_window.php

// Set a variable for problem reporting.
$okay = FALSE;


// Make sure an image name was passed to the script.
if (isset($_GET['image'])) {
   // Get the extension of the image name.
   $ext = substr ($_GET['image'], -4);
   // Test if it's a valid image extension.
   if ((strtolower($ext) == '.jpg') OR (strtolower($ext) == 'jpeg') OR (strtolower($ext) == '.gif')) {
      // Get the image information and display the image.
     if ($image = @getimagesize ('uploads/' . $_GET['image'])) {
        echo "<img src="C:/xampp/uploads/{$_GET['image']}\" $image[3] border=\"2\" />";        $okay = TRUE; // No problems.
     }
   } // End of extension IF.
} // End of isset() IF.


// If something went wrong...
if (!$okay) {
   echo '<div align="center"><font color="red" size="+1">This script must receive a valid image name!</font></div>';
}
?>
<br />
<div align="center"><a href="javascript:self.close();">Close This Window</a></div>
</body>
</html>

Any insight would truly be appreciated. Thank you!

CC





Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Parse error: parse error, unexpected T_STRING geminient PHP How-To 4 August 18th, 2007 02:27 AM
parse error $end pag 118 table3.php vkranendonk BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 February 2nd, 2006 12:05 PM
php parse error ajit_kunte BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 2 May 2nd, 2005 07:24 AM
MySQL & PHP Parse error Stuart BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 March 17th, 2005 03:44 PM





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