473,698 Members | 2,450 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

parse error expecting "(" in line 93

5 New Member
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 1865
zorgi
431 Recognized Expert Contributor
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
drgnhiker
5 New Member
Oh my gosh.......spac e removed....repl aced a missing comma and all is fine in the world.....Thank s you so much
Feb 12 '10 #3

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

Similar topics

0
2254
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 successfully accessing methods in this DLL in some of my classes. "Interop.CRYPTOLib" is the name of the interop VS.NET created for me when I added the reference. Frequently, when I try to run my application, I get the error that follows.
2
2008
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 not the intended recipient (c) you consider this email to be spam.
6
6105
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 I received an error message: "The ConnectionString property has not been initialized.
3
8826
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 don't think I made any changes to either page other than changing the user control that creates the header). Server Error in '/myApp' Application. ---------------------------------------------------------------------------- ----
5
3201
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 ====== Code error:
0
1458
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 the cause of this problem.. Please suggest asap.. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error
8
8986
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 ************************************************************************* Error : type specifier omitted for parameter string.h line 30 ************************************************************************ The following is the line where I get this error: Line 30 : # if (_STLP_OUTERMOST_HEADER_ID == 0x269) Line 31...
2
1997
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 is on, and double clicking on the error does not take me there. I am on a clean installation of windows xp sp2. I've attached a link to a photo of the problem. Notice that the error line and other info are empty....
1
541
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 OleDbParameterCollection" whenI try to write a new record. Delete and Modify work fine its just the add record function causes the error.
5
3554
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 this error. Any idea why? Server Error in '/myuser4/MyWebApp' Application. --------------------------------------------------------------------------------
0
8604
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9160
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7729
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6521
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2331
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.