473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Parser Error with Double Quotes


Hi all,
I am new to PHP programming.

When I started with small examples of PHP, i landed with such errors
which make me feel annoying.

Incase of this snippet
---------
06 <?php
07 echo "Click here to see information about my favorite movie!";
08 echo "</a>";
09 ?>
-----------------------------------

the following error occurs..

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in
C:\Program Files\xampp\htdocs\movie1.php on line 7

But while i replace the double quotes with single; everything works
perfectly..

Please comment on this.

Regards,
madan

Apr 9 '06 #1
5 1739
Message-ID: <11**********************@g10g2000cwb.googlegroups .com> from
SharkHunter contained the following:
Incase of this snippet
---------
06 <?php
07 echo "Click here to see information about my favorite movie!";
08 echo "</a>";
09 ?>


What's in the lines above?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Apr 9 '06 #2
The complete file would be

<html>
<head>
<TITLE>Find my Favorite Movie!</TITLE>
</head>
<body>
<?php
echo "Click here to see information about my favorite movie!";
echo "</a>";
?>
</body>
</html>

Thanks

Apr 9 '06 #3
Message-ID: <11**********************@u72g2000cwu.googlegroups .com> from
SharkHunter contained the following:
<html>
<head>
<TITLE>Find my Favorite Movie!</TITLE>
</head>
<body>
<?php
echo "Click here to see information about my favorite movie!";
echo "</a>";
?>
</body>
</html>


Nothing wrong with that. I think you have missed out the bit that as
causing the error.

I suspect your original script looked like this:
<?php
echo "<a href="somepage.php" >Click here to see information about my
favorite movie!";
echo "</a>";
?>

The quotes in the anchor tag need to be escaped (ie preceded by a
backslash like so \" ) or replaced with single quotes.

Having said that, there is no need for double quotes unless the echoed
part contains a variable which you want to expand. Therefore using
single quotes is fine. e.g.

<?php
echo '<a href="somepage.php" >Click here to see information about my
favorite movie!';
echo '</a>';
?>

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Apr 9 '06 #4
Thanks Anyway, I have solved it.
The prpblem is that i have copied these examples from the pdf. so the
Double quotes used in the pdf are not being parsed by PHP.

So this solves. it.

Thanks.
Madan

Apr 9 '06 #5
Thanks a lot for your reply..
But the problem was with myself trying the code as per the pdf.

Regards,
Madan

Apr 9 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MistralZ | last post by:
Hi all! I am using Oracle XML parser ver 9.0.1.0.0 for C++ and I am having a strange problem with quotes. Parser throws a parsing error when trying to parse attributes containing quotes (even...
5
by: Mad Scientist Jr | last post by:
Has anyone worked on code that that can parse evaluation expressions (could be numbers or strings) like ( ( "dog" = "dog" ) or "foo" = "bar" ) and ("cow" = "bat" and "bye" = "hi") or ("math" =...
7
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password...
6
by: Phlip | last post by:
C++ newsgroupies: I wrote a parser to solve math expressions like "3.0 ^(4 - 5)", or "3 / 8". It's bad luck to name an interface after its implementation. This file could have been...
4
by: Greg B | last post by:
Well since getopt() doesn't seem to be compatible with Windows, and the free implementation of it for Windows that I found still had some annoying restrictions, I thought I'd whip up a simple...
14
by: WUV999U | last post by:
Hi I am fairly familiar in C but not much. I want to know how I can write a html parser in C that only parses for the image file in the html file and display or print all the images found in...
12
by: Raed Sawalha | last post by:
I have the following table which i can not switcha to design view error message said Could not open in Design view. Quote values differently inside a '<% ...."value"... %>' block. and the...
7
by: Fuzzyman | last post by:
Hello all, I'm writing a module that takes user input as strings and (effectively) translates them to function calls with arguments and keyword arguments.to pass a list I use a sort of 'list...
2
by: jwbrown77 | last post by:
Hello, I am trying to read a csv file. I have the following functioning code: ---- BEGIN ---- import csv reader = csv.reader(open("test.csv", "rb"), delimiter=';')
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.