Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: Problem with Parse error


Message #1 by "Lourens Naudé" <lourens@e...> on Fri, 20 Jul 2001 14:17:48
The error is before this line.  As Adam said, look for a } or a ; that is
missing somewhere above the referenced line of code.

Richard

Lourens NaudX wrote:

> I get the following error message: "Parse error: parse error in
> c:\jobspursuit\public\education.php on line 293". Line 293 is the "?>"
> right at the end of this code :
>
> <?php
> //Start buffer on server
> ob_start();
> ob_implicit_flush(0);
> GLOBAL $HTTP_SESSION_VARS;
> //MySQL session management module
> require("./../includes/session.inc");
> //Prints form error message in red
> require("./../includes/form.inc");
> //MySQL connection info
> require("./../includes/connect.inc");
> session_set_save_handler
> ("sess_mysql_open", "", "sess_mysql_read", "sess_mysql_write", "sess_mysql_
> destroy", "sess_mysql_gc");
> //MySQL connection for education.php
> $link = mysql_connect($host,$user,$password) or die(mysql_error());
> //Convert form values to session variables
> if ($REQUEST_METHOD == "POST") {
> reset ($HTTP_POST_VARS);
> while (list ($key, $val) = each ($HTTP_POST_VARS)) {
>  if (session_is_registered($key)  && $key != "Submit")
>    { $HTTP_SESSION_VARS[$key] = $val; }
>  elseif ($key != "Submit")
>    { session_register($key);
>      $HTTP_SESSION_VARS[$key] = $val;  }
>   }
>  //Check if all fields in row are not empty
>  $count = 0;
>  for ($x=0; $x<sizeof($HTTP_SESSION_VARS["institute"]); $x++)
>         {
>                 if($HTTP_SESSION_VARS["institute[$x]"] != ""  ||
> $HTTP_SESSION_VARS["degree_year[$x]"] != "")
>                 {
>                         if($HTTP_SESSION_VARS["degree[$x]"] == "" ||
> $HTTP_SESSION_VARS["degree_year[$x]"] == "" || !is_numeric
> ($HTTP_SESSION_VARS["degree_year[$x]"]))
>                         {
>                         $count++;
>                        }
>                 }
>         }
> echo $count;
> if ($count == 0) {
>   for($x=0; $x<sizeof($HTTP_SESSION_VARS["institute"]); $x++)
>                 {
>                        if ($HTTP_SESSION_VARS["institute[$x]"] != "" &&
> $HTTP_SESSION_VARS["degree_year[$x]"] != "")
>                        {
>                         $query = "INSERT INTO Education (jsid, institute,
> degree, subject, year) VALUES ('".$HTTP_SESSION_VARS
> ["jsid"]."', '".$HTTP_SESSION_VARS["institute
> [$x]"]."', '".$HTTP_SESSION_VARS["degree[$x]"]."', '".$HTTP_SESSION_VARS
> ["subject[$x]"]."', '".$HTTP_SESSION_VARS["degree_year[$x]"]."')";
>                         $edcucation = mysql_db_query($db,$query,$link) or
> die (mysql_error());
>                       }
>                 }
>
> echo $query;
> mysql_free_result($education);
> //Clear session variables used in education.php
> reset($HTTP_SESSION_VARS);
> while (list ($key, $val) = each ($HTTP_SESSION_VARS) && $key != "jsid") {
>  session_unregister($key); }
> //Unset variables used in script
> unset($query,$count,$key,$val);
> //Redirect to history.php
> Header("Location: history.php");
> }
> ?>
> <html><!-- #BeginTemplate "/Templates/jobspursuit.dwt" -->
> <head>
> <!-- #BeginEditable "doctitle" -->
> <title>Home</title>
> <!-- #EndEditable -->
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
> <?php //Results for degree and subject recordsets
>  $result_degree = mysql_db_query($db,"SELECT * FROM degree");
>  $result_subject = mysql_db_query($db,"SELECT * FROM subject");
> ?>
> <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"
> marginwidth="0" marginheight="0">
> <div align="center">
>   <table width="716" border="0" cellspacing="0" cellpadding="0">
>     <tr valign="top" align="left">
>       <td colspan="3"><img src="../assets/header/header.gif" width="720"
> height="105" usemap="#Map2" border="0"></td>
>     </tr>
>     <tr>
>       <td colspan="3" align="left" valign="top" height="13">
>         <div align="center">
>           <table width="100%" border="0" cellspacing="0" cellpadding="0">
>             <tr>
>               <td width="20%" valign="top" align="left"><img
> src="../assets/left/left.gif" width="145" height="500"></td>
>               <td width="60%" valign="top"><!-- #BeginEditable "Content" --
> >
>                 <div align="center">
>                   <form name="education" method="POST"
> action="education.php">
>                   <table width="100%" border="0" cellspacing="5"
> cellpadding="2">
>                     <tr>
>                       <td colspan="4"><font size="4"><b><font
> color="#003399">Educational
>                         Qualifications</font></b></font></td>
>                     </tr>
>                     <tr>
>                       <td colspan="4"><i>You may fill all or none of the
> rows
>                         below; ensure that no fields are left empty per
> filled-in
>                         row</i></td>
>                     </tr>
>                     <tr>
>                       <td width="28%">Institute/University<br>
>                         (example: XYZ University)</td>
>                       <td width="26%">Degree<br>
>                         (example: Master's degree)</td>
>                       <td width="24%">Primary subject<br>
>                         (example: Accounting)</td>
>                       <td width="22%">Year<br>
>                         (example: 1992)</td>
>                     </tr>
>
>               <?php
>                $Message = "";
>                if ($REQUEST_METHOD == "POST") {
>                for ($x=0; $x < sizeof($HTTP_SESSION_VARS["institute"]);
> $x++)
>                 {
>                      if($HTTP_SESSION_VARS["institute[$x]"] != "" ||
> $HTTP_SESSION_VARS["degree_year[$x]"] != "")
>                         {
>                           if($HTTP_SESSION_VARS["degree[$x]"] == "" ||
> $HTTP_SESSION_VARS["degree_year[$x]"] == "" || !is_numeric
> ($HTTP_SESSION_VARS["degree_year[$x]"]))
>                             { $Message = "Please ensure that all fields
> per row are not empty";}
>                         }
>                 }
>                  if ( $Message != "" )
>                    {PrintError($Message);}
>                   }?>
>                     <tr>
>                       <td width="28%">
>                         <input type="text" name="institute[0]" size="20"
> maxlength="255"  value = <? echo $HTTP_SESSION_VARS["institute[0]"]; ?>>
>                       </td>
>                       <td width="26%">
>                         <select name="degree[0]">
>                         <?php
>                           while (list($id, $degree) = mysql_fetch_row
> ($result_degree))
>                             { echo "<option value=$id>$degree</option>"; }
>                           mysql_data_seek($result_degree, 0); ?>
>                         </select>
>                       </td>
>                       <td width="24%">
>                         <select name="subject[0]">
>                            <?php
>                              while (list($id, $subject) = mysql_fetch_row
> ($result_subject))
>                             { echo "<option value=$id>$subject</option>"; }
>                           mysql_data_seek($result_subject, 0);
>                             ?>
>                         </select>
>                       </td>
>                       <td width="22%">
>                         <input type="text" name="degree_year[0]" size="4"
> maxlength="4" value = <? echo $HTTP_SESSION_VARS["degree_year[0]"]; ?>>
>                       </td>
>                     </tr>
>                     <tr>
>                       <td width="28%">
>                         <input type="text" name="institute[1]" size="20"
> maxlength="255" value = <? echo $HTTP_SESSION_VARS["institute[1]"]; ?>>
>                       </td>
>                       <td width="26%">
>                         <select name="degree[1]">
>                           <?php
>                            while (list($id, $degree) = mysql_fetch_row
> ($result_degree))
>                             { echo "<option value=$id>$degree</option>"; }
>                           mysql_data_seek($result_degree, 0);?>
>                         </select>
>                       </td>
>                       <td width="24%">
>                         <select name="subject[1]">
>                            <?php
>                              while (list($id, $subject) = mysql_fetch_row
> ($result_subject))
>                             { echo "<option value=$id>$subject</option>"; }
>                           mysql_data_seek($result_subject, 0);
>                             ?>
>                         </select>
>                       </td>
>                       <td width="22%">
>                         <input type="text" name="degree_year[1]" size="4"
> maxlength="4"  value = <? echo $HTTP_SESSION_VARS["degree_year[1]"]; ?>>
>                       </td>
>                     </tr>
>                     <tr>
>                       <td width="28%">
>                         <input type="text" name="institute[2]" size="20"
> maxlength="255" value = <? echo $HTTP_SESSION_VARS["institute[2]"]; ?>>
>                       </td>
>                       <td width="26%">
>                         <select name="degree[2]">
>                         <?php
>                          while (list($id, $degree) = mysql_fetch_row
> ($result_degree))
>                             { echo "<option value=$id>$degree</option>"; }
>                           mysql_data_seek($result_degree, 0);?>
>                         </select>
>                       </td>
>                       <td width="24%">
>                         <select name="subject[2]">
>                          <?php
>                              while (list($id, $subject) = mysql_fetch_row
> ($result_subject))
>                             { echo "<option value=$id>$subject</option>"; }
>                           mysql_data_seek($result_subject, 0);
>                             ?>
>                         </select>
>                       </td>
>                       <td width="22%">
>                         <input type="text" name="degree_year[2]" size="4"
> maxlength="4"  value = <? echo $HTTP_SESSION_VARS["degree_year[2]"]; ?>>
>                       </td>
>                     </tr>
>                     <tr>
>                       <td width="28%">
>                         <input type="text" name="institute[3]" size="20"
> maxlength="255" value = <? echo $HTTP_SESSION_VARS["institute[3]"]; ?>>
>                       </td>
>                       <td width="26%">
>                         <select name="degree[3]">
>                            <?php
>                              while (list($id, $degree) = mysql_fetch_row
> ($result_degree))
>                             { echo "<option value=$id>$degree</option>"; }
>                           mysql_data_seek($result_degree, 0);
>                             ?>
>                         </select>
>                       </td>
>                       <td width="24%">
>                         <select name="subject[3]">
>                            <?php
>                              while (list($id, $subject) = mysql_fetch_row
> ($result_subject))
>                             { echo "<option value=$id>$subject</option>"; }
>                           mysql_data_seek($result_subject, 0);
>                             ?>
>                         </select>
>                       </td>
>                       <td width="22%">
>                         <input type="text" name="degree_year[3]" size="4"
> maxlength="4"  value = <? echo $HTTP_SESSION_VARS["degree_year[3]"]; ?>>
>                       </td>
>                     </tr>
>                     <tr>
>                       <td width="28%">
>                         <input type="text" name="institute[4]" size="20"
> maxlength="255" value = <? echo $HTTP_SESSION_VARS["institute[4]"]; ?>>
>                       </td>
>                       <td width="26%">
>                         <select name="degree[4]">
>                           <?php
>                              while (list($id, $degree) = mysql_fetch_row
> ($result_degree))
>                             { echo "<option value=$id>$degree</option>"; }
>                           mysql_data_seek($result_degree, 0);
>                             ?>
>                         </select>
>                       </td>
>                       <td width="24%">
>                         <select name="subject[4]">
>                             <?php
>                              while (list($id, $subject) = mysql_fetch_row
> ($result_subject))
>                             { echo "<option value=$id>$subject</option>"; }
>                           mysql_data_seek($result_subject, 0);
>                           mysql_free_result($result_degree);
>                           mysql_free_result($result_subject);
>                             ?>
>                         </select>
>                       </td>
>                       <td width="22%">
>                         <input type="text" name="degree_year[4]" size="4"
> maxlength="4"  value = <? echo $HTTP_SESSION_VARS["degree_year[4]"]; ?>>
>                       </td>
>                     </tr>
>                     <tr valign="top" align="center">
>                       <td colspan="4">
>                         <input type="submit" name="Submit" value="Step 3 :
> Employment History">
>                       </td>
>                     </tr>
>                   </table>
>                  </form>
>                 </div>
>                 <!-- #EndEditable --></td>
>               <td width="20%" valign="top" align="right"><img
> src="../assets/right/right.gif" width="145" height="500"></td>
>             </tr>
>           </table>
>         </div>
>         </td>
>     </tr>
>     <tr>
>       <td width="160" align="left" valign="top"> </td>
>       <td width="401" valign="top" align="center">
>         <div align="center"><font size="2">| <a
> href="../index.php">Home</a> |
>           <a href="registerdetails.php">CV Registration</a> | <a
> href="../index.php">Services</a>
>           | <a href="../index.php">Media Kit</a> | <a
> href="../index.php">Career
>           Headlines</a> |<br>
>           | <a href="../index.php">Salary Tracker</a> | <a
> href="../index.php">Discussions</a>
>           | <a href="../index.php">Career Resources</a> | <a
> href="../index.php">About</a>
>           |</font></div>
>       </td>
>       <td width="160" align="right" valign="top"> </td>
>     </tr>
>   </table>
> </div>
> <map name="Map2">
>   <area shape="rect" coords="67,87,161,106" href="register.php">
> </map>
> </body>
> <!-- #EndTemplate --></html>
> <?php
> unset($id,$degree,$subject);
> //Close MySQL connection
> mysql_close($link);
> //Output buffer to browser
> $contents = ob_get_contents();
> ob_end_clean();
> echo $contents;
> ?>


  Return to Index