Hello evryone! i am very new to PHP! I study it with ebook: PHP & MySQL For Dummies , 3rd Edition!
Once i try and have copy the whole code from the book like this(write in notepad)


_______________________

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo “This is a PHP line”;
phpinfo();
?>
</body></html>

___________________________

and save to C:\wamp\www\ss\a.php then i open wamp server with crome and switch to
http://localhost/ss/a.php

but it show:
________________________________
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\wamp\www\ss\a.php on line 9
___________________________________

Why it is crazy like that?
in that book the author tell that it should display
_____________
This is an HTML line This is a PHP line
_______________

Help me please!
<FAKE SIGNATURE DELETED>

Recommended Answers

All 6 Replies

you just try either
echo phpinfo();

or remove the semicolon after the "This is a php line"

Reply if it fixes..

The type of quotes you used are invalid. I've never seen double italic quotes like that before but the following should do the job.

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
//before was: echo “This is a PHP line”;
echo "This is a PHP line"; //now is
phpinfo();
?>
</body></html>

Hope that helps.

When you copy from books it put qoutes not like this "
please change qoutes with these "

Use this code and mark this thread as solved , Thanks.

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
</p>
<?
echo "This is a PHP line";
phpinfo();
?>
</body></html>

Thank all i am OK now!

Please mark this thread as Solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.