Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP Parse Error

Community Beginner ,
Sep 03, 2006 Sep 03, 2006
I'm somehwat new to PHP in Dreamweaver but understand it well enough to be totally confused as to why I'm getting the following error on page load:

Parse error: syntax error, unexpected '{'

Help!?
TOPICS
Server side applications
581
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Sep 04, 2006 Sep 04, 2006
Thanks David. That did the trick. Cutting and pasting code that has errors in it....beginner indeed.

Just finished your book last week, was a great intro to PHP & DW8, really helpful.

Cheers.
Translate
LEGEND ,
Sep 03, 2006 Sep 03, 2006
lbombardier wrote:
> I'm somehwat new to PHP in Dreamweaver but understand it well enough
> to be totally confused as to why I'm getting the following error on
> page load:
>
> Parse error: syntax error, unexpected '{'
>
> Help!?
>
<snip>

At the very end of the code,


if ((isset($_POST["MM_insert"])) {
mysql_free_result($rsCart);
}

I think those lines should be

if (isset($_POST["MM_insert"])) {
mysql_free_result($rsCart);
}

(removed an extra opening bracket)

Caveat: I've only checked your code visually, so the real error may well be
somewhere else!

HTH,

Pete.
--
Peter Connolly
http://www.acutecomputing.co.uk
Derby
UK
Skype ID: acutecomputing


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 03, 2006 Sep 03, 2006
your error message should tell you which line the error occured on.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 04, 2006 Sep 04, 2006
lbombardier wrote:
> I'm somehwat new to PHP in Dreamweaver but understand it well enough to be
> totally confused as to why I'm getting the following error on page load:
>
> Parse error: syntax error, unexpected '{'

A parse error is caused by a mistake in your PHP code. There are
actually four mistakes in your page. These are all mistakes in your own
coding, not in anything generated by Dreamweaver. The first is on line 2:

> <?php if ((isset($_POST['MM_insert'])) {

Remove the first opening parenthesis. It should look like this:

<?php if (isset($_POST['MM_insert'])) {

The next error is on line 17:

> if ($totalRows_rsCart > 0 {

The closing parenthesis is missing from your conditional statement:

if ($totalRows_rsCart > 0) {

The next mistakes are on lines 69 and 118:

> if ((isset($_POST["MM_insert"])) {

It's the same mistake as on line 2 (an extra opening parenthesis):

if (isset($_POST["MM_insert"])) {

Parse errors are the most common beginner's mistakes in PHP. When you
get a parse error, check that all quotes, parentheses, braces, and
brackets are in matching pairs. Also check for missing semicolons at the
end of commands. The error message tells you which line it encountered a
problem. This is not always the location of the error, so you need to
start looking backwards from that point if you can't find anything wrong
on that particular line.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 04, 2006 Sep 04, 2006
LATEST
Thanks David. That did the trick. Cutting and pasting code that has errors in it....beginner indeed.

Just finished your book last week, was a great intro to PHP & DW8, really helpful.

Cheers.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines