Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 16th, 2004, 08:07 PM
Registered User
 
Join Date: Oct 2004
Location: , , Canada.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to willburke
Default Parse error: CH7 p198

Hello people, This book is great, I'm finding acouple of errors that I can't solve.

Parse error: parse error, unexpected '}', expecting ']' in E:\web\test\chapter7\commit.php on line 67

my code is as follows:

<?php
    //COMMIT ADD AND EDITS
    $error = '';
    //Connect to the mysql server
    $link = mysql_connect("localhost","root","xxxxxxxxx") or die("Could not connect: " . mysql_error());

    //Use the correct database
    mysql_select_db('wiley',$link) or die(mysql_error());

    //Code Commit Action
    switch($_GET['action'])
    {
        case "edit":
            switch( $_GET['type'] )
            {
                case "people":
                    $sql = "UPDATE
                                people
                            SET
                                people_fullname = '".$_POST['people_fullname']."'
                            WHERE
                                people_id = '".$_GET['id']."'
                           ";
                    break;
                case "movie":
                    $movie_name = trim($row['movie_name']);
                    if(empty($movie_name))
                    {
                        $error .= "Please+enter+a+movie+name%21%0D%0A";
                    }
                    if(empty($_POST['movie_type']))
                    {
                        $error .= "Please+select+a+movie+type%21%0D%0A";
                    }
                    if(empty($_POST['movie_year']))
                    {
                        $error .= "Please+select+a+movie+year%21%0D%0A";
                    }
                    if(empty($error))
                    {
                    $sql = "UPDATE
                                movie
                            SET
                                movie_name = '".$_POST['movie_name']."',
                                movie_year = '".$_POST['movie_year']."',
                                movie_type = '".$_POST['movie_type']."',
                                movie_leadactor = '".$_POST['movie_leadactor']."',
                                movie_director = '".$_POST['movie_director']."'
                            WHERE
                                movie_id = '".$GET['id']."'
                           ";
                    }
                    else
                    {
                        header("location:movie.php?action=edit&error=".$er ror."&id=".$_GET['id']);
                    }
                    break;
            }
            break;

        case "add":
            switch($_GET['type'])
            {
                case "people":
                    $sql = "INSERT INTO
                                              people(people_fullname)
                    VALUES // Line 67
                                ('".$_POST['people_fullname']."')
                           ";
                    break;
                case "movie":
                    $movie_name = trim($row['movie_name']);
                    if(empty($movie_name))
                    {
                        $error .= "Please+enter+a+movie+name%21%0D%0A";
                    }
                    if(empty($_POST['movie_type']))
                    {
                        $error .= "Please+select+a+movie+type%21%0D%0A";
                    }
                    if(empty($_POST['movie_year']))
                    {
                        $error .= "Please+select+a+movie+year%21%0D%0A";
                    }
                    if(empty($error))
                    {
                        $sql = "INSERT INTO
                                movie
                                (movie_name,movie_year,movie_type,movie_leadactor, movie_director)
                            VALUES
                                ('".$_POST['movie_name']."',
                                '".$_POST['movie_year']."',
                                '".$_POST['movie_type']."',
                                '".$_POST['movie_leadactor']."',
                                '".$_POST['movie_director']."')
                            ";
                    }
                    else
                    {
                        header("location:movie.php?action=add&error=".$err or);
                    }
                break;
            }
        break;
    }
    if (isset($sql) && !empty($sql))
    {
        echo "";
        $result = mysql_query($sql) or die("Invalid query: " . mysql_error());
?>
        <p align="center" style="color:#ff0000">
            Done. <a href="index.php">Index</a>
        </p>
<?php
    }
?>

Any help would be a great help!

Thank you
will burke



Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected T_ELSE in /h vipin k varghese BOOK: XSLT Programmer's Reference, 2nd Edition 4 September 29th, 2011 01:19 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
PHP Parse error: parse error, unexpected T_STRING geminient PHP How-To 4 August 18th, 2007 02:27 AM
Parse error: parse error, unexpected $end Ayodeji Adegbaju Pro PHP 3 January 12th, 2007 12:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.