473,387 Members | 3,781 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,387 software developers and data experts.

parse error expecting "(" in line 93

And I seem to be missing the error...can't find it and the statements in one section duplicate other sections with no error....any help would be greatly appreciated: the following is the entire code...(Yes I know it is from a book but I got to learn it all from someplace :).....thanks in advance for any and all help and advice.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $db = mysql_connect('localhost', 'bp6am', '*****') or
  3.     die ('Unable to connect. Check your connection parameters.');
  4. mysql_select_db('moviesite', $db) or die(mysql_error($db));
  5.  
  6. if ($_GET['action'] == 'edit') {
  7. //retrieve the record's information
  8.    $query = 'SELECT
  9.        movie_name, movie_type, movie_leadactor, movie_director
  10.      FROM
  11.        movie
  12.      WHERE
  13.        movie_id =  ' . $_GET['id'];
  14.   $result = mysql_query($query, $db) or die(mysql_error($db));
  15.   extract(mysql_fetch_assoc($result));
  16. } else{
  17.   //set values to blank
  18.   $movie_name = '';
  19.   $movie_type = 0;
  20.   $movie_year = date('Y');
  21.   $movie_leadactor = 0;
  22.   $movie_director = 0;
  23. }
  24. ?>
  25. <html>
  26.  <head>
  27.   <title><?php echo ucfirst($_GET['action']); ?> MovieAdd Movie</title>
  28.  </head>
  29.   <body>
  30.    <form action="commit.php?action=<?php echo $_GET['action']; ?>&type=movie" method="post">
  31.     <table>
  32.      <tr>
  33.       <td>Movie Name</td>
  34.       <td><input type="text" name="movie_name" value="<?php echo $movie_name; ?>"/></td>
  35.      </tr><tr>
  36.       <td>Movie Type</td>
  37.       <td><select name="movie_type">
  38. <?php
  39. //select movie type information  line 39
  40. $query = 'SELECT
  41.        movietype_id, movietype_label
  42.      FROM
  43.        movietype
  44.      ORDER BY
  45.        movietype_label';
  46. $result = mysql_query($query, $db) or die(mysql_error($db));
  47.  
  48. //populate the select options with the results
  49. while ($row = mysql_fetch_assoc($result)) {
  50.      foreach ($row as $value){
  51.          if ($row['movietype_id'] == $movie_type) {
  52.              echo '<option value="' . $row['movieytpe_id'] .'" selected="selected">';
  53.          } else {
  54.              echo '<option value="' . $row['movietype_id'] . '">';
  55.  
  56.          }
  57.          echo $row['movietype_label'] . '</option>';
  58.          }
  59. }
  60. ?>
  61.       </select></td>
  62.      </tr><tr>
  63.       <td>Movie Year</td>
  64.       <td><select name="movie_year">
  65. <?php
  66. // populate the select options with years line 66
  67. for ($yr = date("Y"); $yr >= 1960; $yr--) {
  68.      if ($yr == $movie_year) {
  69.          echo '<option value="' . $yr . '" selected="selected">' . $yr . '</option>';
  70.      } else {
  71.          echo '<option value="' . $yr . '">' . $yr . '</option>';
  72.      }
  73. }
  74. ?>
  75.      </select></td>
  76.     </tr><tr>
  77.      <td>Lead Actor</td>
  78.      <td><select name="movie_leadactor">
  79. <?php
  80. //select actor records
  81. $query = 'SELECT
  82.        people_id, people_fullname
  83.     FROM
  84.        people
  85.     WHERE
  86.        people_isactor = 1
  87.     ORDER BY
  88.        people_fullname';
  89. $result = mysql_query($query, $db) or die(mysql_error($db));
  90.  
  91. //populate the select options with the results line 91
  92. while ($row = mysql_fetch_assoc($result)) {
  93.       for each ($row as $value) {
  94.           if ($row['people_id'] == $movie_leadactor) {
  95.           echo '<option value="' . $row['people_id'] . '" selected="selected">';
  96.       } else {
  97.           echo '<option value="' . $row['people_id'] . '">';   
  98.       }
  99.       echo $row['people_fullname'] . '</option>';
  100.    }
  101. }
  102. ?>
  103.       </select></td>
  104.      </tr><tr>
  105.      <td>Director</td>
  106.      <td><select name="movie_director">
  107. <?php
  108.  
  109. //select director records line 109
  110. $query = 'SELECT
  111.        people_id, people_fullname
  112.      FROM
  113.        people
  114.      WHERE
  115.        people_isdirector = 1
  116.      ORDER BY
  117.        people_fullname';
  118. $result = mysql_query($query, $db) or die(mysql_error($db));
  119.  
  120. //populate the select options with the results
  121. while ($row = mysql_fetch_assoc($result)) {
  122.      foreach ($row as $value) {
  123.         if ($row['people_id'] == $movie_director) {
  124.             echo '<option value="' . $row['people_id'] . '" selected="selected">';
  125.         } else {
  126.             echo '<option value="' . $row['people_id'] . '">';
  127.         }
  128.         echo $row['people_fullname'] . '</option>';
  129.      }
  130. }
  131. ?>
  132.       </select></td>
  133.      </tr><tr>
  134.       <td colspan="2" style="text-align: center;">
  135. <?php 
  136. if ($_['action'] == 'edit') {
  137.       echo '<input type="hidden value="' . $_GET['id'[ . '" name="movie_id" />';
  138. }
  139. ?>
  140.        <input type="submit" name="submit" value="<?php echo ucfirst($_GET['action']); ?>" />
  141.       </td>
  142.      </tr>
  143.     </table>
  144.    </form>
  145.   </body>
  146. </html>
  147.  
Feb 11 '10 #1
2 1854
zorgi
431 Expert 256MB
I didn't try to understand the logic of your code, so this might not be the only problem with it, but line 93:
Expand|Select|Wrap|Line Numbers
  1. for each ($row as $value)
  2.  
should be

Expand|Select|Wrap|Line Numbers
  1. foreach ($row as $value)
  2.  
Feb 11 '10 #2
Oh my gosh.......space removed....replaced a missing comma and all is fine in the world.....Thanks you so much
Feb 12 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: jb_in_marietta | last post by:
I have a Dot Net project that references a COM DLL called "Crypto.dll," which is registered on my machine. I added the reference via the "Add Reference" dialog in Visual Studio Dot Net, and I am...
2
by: WindAndWaves | last post by:
Is it possible to find out at what line an error occurred for an error log??? --- Please immediately let us know (by phone or return email) if (a) this email contains a virus (b) you are...
6
by: Tony | last post by:
Dear All, When I run an example program on the http://www.dotnetjunkies.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/data/datagrid1.src&file=VB\datagrid1.aspx&font=3 ...
3
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I...
5
by: Kevin R | last post by:
I'm trying to update a sql database. It's modified Oledb code from an example that did work with an access database. How can I tweak my code to make it work? Thanks in advance. Kevin...
0
by: ksayal | last post by:
Hi, I'm creating a project. Whenever I try to add a user control or add an aspx page it gives me the following error. When I remove the inherits="" thing, it shows up the page.... What would be...
8
by: eminemence | last post by:
Hi, I have been trying to get STLPort work for Symbian. I am using CodeWarrior compiler and it spews this errors namely *************************************************************************...
2
by: Tony | last post by:
In visual studio 2005, while debugging a new web project in C#, the error line does not show up in the error dialog box. The actual error shows up correctly, but it does not tell me what line it...
1
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
5
by: Cirene | last post by:
I just deployed my new ASP.NET (3.5 FW) site to the hosting company I'm using, webhost4life. NOTE: I HAVE deployed other SQL Server sites to the same account with no issues. Now I'm getting...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.