Wrox Programmer Forums
|
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 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
 
Old November 14th, 2010, 06:00 AM
Registered User
 
Join Date: Oct 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Help needed.Chap.6 in movie.php

I get this error messege "Parse error: syntax error, unexpected $end in C:\xampp\htdocs\movie.php on line 143". When I try Adding using Add link for movies in admin.php or by just browsing movie.php in a browser.
HELP ME PLZ..

here is the code for
movie.php

Code:
<?php
$db = mysql_connect('localhost', 'root', '') or die ('Unable to connect. Check your connection parameters.');
mysql_select_db('moviesite', $db) or die(mysql_error($db));
if ($_GET['action'] == 'edit') {
   //retrieve the record's information
   $query = 'SELECT
          movie_name, movie_type, movie_year, movie_leadactor, movie_director
       FROM
          movie
       WHERE
          movie_id = ' . $_GET['id'];
   $result = mysql_query($query, $db) or die(mysql_error($db));
   extract(mysql_fetch_assoc($result));
} else {
   //set values to blank
   $movie_name = '';
   $movie_type = 0;
   $movie_year = date('Y');
   $movie_leadactor = 0;
   $movie_director = 0;
?>
<html>
 <head>
  <title><?php echo ucfirst($_GET['action']); ?>Movie</title>
</head>
 <body>
  <form action="commit.php?action=<?php echo $_GET['action']; ?>&type=movie" method="post">
   <table>
    <tr>
     <td>Movie Name</td>
     <td><input type="text" name="movie_name" value="<?php echo $movie_name; ?>" /></td>
    </tr><tr>
     <td>Movie Type</td>
     <td><select name="movie_type">
<?php
// select movie type information
$query = 'SELECT
        movietype_id, movietype_label
    FROM
        movietype
    ORDER BY
        movietype_label';
$result = mysql_query($query, $db) or die(mysql_error($db));

//populate the select options with the results
while ($row = mysql_fetch_assoc($result)) {
    foreach ($row as $value) {
        if ($row['movietype_id'] == $movie_type) {
            echo '<option value="' . $row['movietype_id'] .
                '" selected="selected">';
        } else {
            echo '<option value="' . $row['movietype_id'] . '">';
        }
        echo $row['movietype_label'] . '</option>';
    }
}
?>
     </select></td>
   </tr><tr>
    <td>Movie Year</td>
    <td><select name="movie_year">
<?php
//populate the select options with years
for ($yr = date("Y"); $yr >= 1970; $yr--) {
     if ($yr == $movie_year) {
    echo '<option value="' . $yr . '" selected="selected">' . $yr . '</option>';
    } else {
      echo '<option value="' . $yr . '">' . $yr . '</option>';
    }
?>
      </select></td>
    </tr><tr>
     <td>Lead Actor</td>
     <td><select name="movie_leadactor">
<?php
//select actor records
$query = 'SELECT
        people_id, people_fullname
    FROM
        people
    WHERE
        people_isactor = 1
    ORDER BY
        people_fullname';
$result = mysql_query($query, $db) or die(mysql_error($db));

//populate the select options with the results
while ($row = mysql_fetch_assoc($result)) {
    foreach ($row as $value) {
        if ($row['people_id'] == $movie_leadactor) {
     echo '<option value="' . $row['people_id'] . '" selected="selected">';
     } else {
       echo '<option value="' . $row['people_id'] . '">'; 
     }
       echo $row['people_fullname'] . '</option>';
    }
}
?>
      </select></td>
    </tr><tr>
     <td>Director</td>
     <td><select name="movie_director">
<?php
//select director records
$query = 'SELECT
        people_id, people_fullname
    FROM
        people
    WHERE
        people_isdirector = 1
    ORDER BY
        people_fullname';
$result = mysql_query($query, $db) or die(mysql_error($db));

//populate the select options with the results
while ($row = mysql_fetch_assoc($result)) {
    foreach ($row as $value) {
       if ($row['people_id'] == $movie_director) {
           echo '<option value="' . $row['people_id'] .
               '" selected="selected">';

       } else {
           echo '<option value="' . $row['people_id'] . '">';
       }
       echo $row['people_fullname'] . '</option>';
    }
}
?>
      </select></td>
    </tr><tr>
     <td colspan="2" style="text-align: center;">
<?php
if ($_GET['action'] == 'edit') {
    echo '<input type="hidden" value="' . $_GET['id'] . '"name="movie_id" />';
}
?>
      <input type="submit" name="submit" value="<?php echo ucfirst($_GET['action']); ?>" />
     </td>
    </tr>
   </table>
  </form>
 </body>
</html>
This parameter is true for my system: parameter: $db = mysql_connect('localhost', 'root', '')





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 10 - issues in rss.php, view.php, and comments on rss kenj BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 0 October 13th, 2010 01:05 AM
Chap 2, Some small errors in add_post.php and view.php kenj BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 0 October 22nd, 2009 07:48 PM
php5 chap 15 help needed twr Beginning PHP 1 January 5th, 2008 06:20 AM
ch 6 commit.php problem updating movie table statusquo BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 May 2nd, 2005 10:02 PM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM





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