Forum Moderators: coopster

Message Too Old, No Replies

Parse error: parse error, unexpected '>' in /home/kxenuqbo/public_html

         

sammy111

5:36 pm on Feb 19, 2006 (gmt 0)

10+ Year Member



Hi I am new to PHP and have staretd to learn the language.
Its a simple query: I am getting the following error message and hope someone could inform me as to why:
thanks in advance.
Parse error: parse error, unexpected '>' in /home/kxenuqbo/public_html/Calendarpg.php on line 6

Heres the code:

<html>
<head><title>Hello World Program</title></head>
<body>
<?php
echo “<p>Hello World!”
?>
</body>
</html>

wsmeyer

5:43 pm on Feb 19, 2006 (gmt 0)

10+ Year Member



You need a semicolon after the php statement, like this:

<?php
echo “<p>Hello World!”;
?>

William.

wsmeyer

5:48 pm on Feb 19, 2006 (gmt 0)

10+ Year Member



Thought of more :)

Multiple statements would look like this:

<?php
echo “<p>";
echo "Hello ";
echo "World!”;
?>

William.

sammy111

5:51 pm on Feb 19, 2006 (gmt 0)

10+ Year Member




Hi - thanks for your reply.
I have tried it but I now get the following:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/kxenuqbo/public_html/Calendarpg.php on line 6

Here is the code i typed in with the semicolon.
<html>
<head><title>Hello World Program</title></head>
<body>
<?php
echo “<p>Hello World!”;
?>
</body>
</html>

By any chance do you have any other suggestions?
thanks again.

wsmeyer

5:55 pm on Feb 19, 2006 (gmt 0)

10+ Year Member



Sorry, I think I drank too much coffee this morning :)

I'm used to always using the semicolon out of habit but technically with just one statement the semicolon is optional. In your original code there is something going on with the quotation marks. This is what it looks like when I copy & paste yours:

“<p>Hello World!”

but when i type it: "<p>Hello World!"

Notice the subtle difference in the quotation marks?

Are you typing this in MS Word or something?

I'm not sure what is the cause but that is DEFINITELY the problem.

William.

sammy111

6:07 pm on Feb 19, 2006 (gmt 0)

10+ Year Member



Hi, yes your right it appears to be the quotation marks.
You see i am typing the php code in to frontpage 2002 and then uploading on the webhost.
i just copied yours and placed in notepad and it appears on the server.
Does that mean it is not possible to write the php code in frontpage? sorry if this is an obvious question...as its all new to me.Im using frontpage to easily create the interface of the website

wsmeyer

6:17 pm on Feb 19, 2006 (gmt 0)

10+ Year Member



You can do it Frontpage, you need to do it in "code view" though. Can't remember exactly what it looked like in FP 2002 but I think you'll have 3 tabs at the bottom of your page: "design", "code" and "preview"?

William.

sammy111

6:46 pm on Feb 19, 2006 (gmt 0)

10+ Year Member



yes, it has 3 options Normal, HTML and Preview. It seems to be parsing the PHP now in frontpage html...I copied and pasted your quotation marks and it seems to work. Not sure why the quotation marks are different in the frontpage html?

wsmeyer

10:18 pm on Feb 19, 2006 (gmt 0)

10+ Year Member



It has something to do with the language FrontPage is set to. The quotes you are seeing are ascii &amp;#147; and &amp;#148; which are Microsoft Windows Latin-1 Added Characters.

I tried playing around with my FP 2003 and I couldn't find a setting that would use those quotes so I'm not sure how to change it.

William.

[edited by: coopster at 2:28 pm (utc) on Feb. 20, 2006]
[edit reason] removed url per TOS [webmasterworld.com] [/edit]