2 Replies - 2098 Views - Last Post: 27 May 2004 - 07:42 PM Rate Topic: -----

#1 doobiedar   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-May 04

Php Parse Error

Posted 27 May 2004 - 05:46 PM

Hi,

I'm working through a book on php and get a parse error with the following code:
<?
$movie=<<<EOD
<h2><center>Movie Review Database</center></h2>
<table width='70%' border='1' cellpadding='2' cellspacing='2' align='center'>
<tr>
<th>Movie Title</th>
<th>Movie Director</th>
<th>Movie Lead Actor</th>
</tr>
</table>
EOD;
echo $movie;
?>

error:
Parse error: parse error in /home/sites/site167/web/php/table1.php on line 16

any ideas??! any help would be appreciated!

Is This A Good Question/Topic? 0
  • +

Replies To: Php Parse Error

#2 doobiedar   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-May 04

Re: Php Parse Error

Posted 27 May 2004 - 05:56 PM

OK - wanna know what the problem was... i had an indent before "EOD;"

that was it. bloooooooooooooooooooooooooooooooooooody hell!!
Was This Post Helpful? 0
  • +
  • -

#3 cyberscribe   User is offline

  • humble.genius
  • member icon

Reputation: 10
  • View blog
  • Posts: 1,062
  • Joined: 05-May 02

Re: Php Parse Error

Posted 27 May 2004 - 07:42 PM

The syntax you are using, while common in C/C++, is pretty useless in PHP unless you are planning to do something fancy with the $movie variable later. In PHP, you can intersperse HTML and code freely, e.g.:

<?PHP 
$title='foo'; 
$title .= 'bar';
?>
...
<strong>Title: </strong><?PHP echo $title ?>
...



or, if you have short_open_tag enabled, more simply:

<?PHP 
$title='foo';
$title .= 'bar';
?>
...
<strong>Title: </strong><?=$title ?>
...



HTH

This post has been edited by cyberscribe: 27 May 2004 - 07:43 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1