Parse error: parse error in C:\wamp\www\smithchr09\Chapter8\ShowBugReport3.php on line 49
I have created three different pages that work together to allow data to be entered via an html form, then displayed, and lastly updated by clicking an update link which takes users to a page that is supposed to populate a form with previously entered data so it can be updated based on a specific count id (Primary key that is auto incremented). Currently all pages are working properly except for the update page. I keep getting the following error message.
Parse error: parse error in C:\wamp\www\smithchr09\Chapter8\ShowBugReport3.php on line 49
Here is the script I have created. The line giving me the error is in red
if (isset($_GET['CountID'])) { $CountID=$_GET['CountID'];
if (isset($CountID)) { $DBConnect = @mysql_connect("150.216.56.44", "smithchr09", "B00471420"); if ($DBConnect === FALSE) echo "<p>Unable to connect to the database server.</p>\n"; else { $DBName = "smithchr09"; $TableName = "bugreport"; if (!@mysql_select_db($DBName, $DBConnect)) echo "<p>Unable to connect to the $DBName database!</p>"; else { $SQLString="SELECT * FROM $TableName WHERE CountID='" . stripslashes($CountID) . "'"; echo $SQLString; $QueryResult = @mysql_query($SQLString, $DBConnect); if ($QueryResult === FALSE) echo "<p>There was an error retrieving the record.<br/>\n" . "The error was " . htmlentities(mysql_error($DBConnect)) . ".<br/>\n The query was '" . htmlentities($SQLString) . "'</p>\n"; else if (mysql_num_rows($QueryResult)==0) { echo "<p>" . stripslashes($CountID) . " is an invalid ID</p>\n"; } else { echo "<p>".mysql_num_rows($QueryResult)."</p>"; $Count=mysql_fetch_assoc($QueryResult); if (isset($_POST['submit'])) { foreach ($Fields as $Field) {
Error in this line --> if ((!isset($_POST[$Field])) || if (strlen(trim($_POST[$Field])) == 0);
echo "<p>is a required field.</p>\n"; $ShowForm=TRUE; } else { $Count[$Field]=stripslashes(trim($_POST[$Field])); } } if ($ShowForm===FALSE) { $connector=""; $SQLString = "UPDATE $TableName SET "; foreach ($Fields as $Field) { $SQLString.= $connector . $field . "='" . $count[$Field] . "'"; $connector=", "; } $SQLString .= " WHERE CountID='".stripslashes($CountID) . "'"; echo "<p>$SQLString</p>";
if ($QueryResult === FALSE) echo "<p>Unable to insert the values into the bug report.</p>"; if ($QueryResult !== FALSE) echo "<p>The interview data has successfully been added to the database.</p>"; } } } if ($ShowForm) { ?> <form method="POST" action="UpdateBugReport3.php"> <p><b>Count ID:<input type="hidden" name="countID" value="<?php echo $Count[$Field]; ?>"/></b></p> <p><b>Product Name:<input type="text" name="product_name" value="<?php echo $Count[$Field]; ?>"/></b></p> <p><b>Version: <input type="text" name="version" value="<?php echo $Count[$Field]; ?>"/></b></p> <p><b>Type of Hardware: <input type="text" name="hardware" value="<?php echo $Count[$Field]; ?>"/></b></p> <p><b>Operating System: <input type="text" name="system" value="<?php echo $Count[$Field]; ?>"/></b></p> <p><b>Frequency of Occurance: </b></p><textarea name="frequency" value="<?php echo $Count[$Field]; ?>" rows="6" cols="80"/></textarea> <p><input type="submit" name="submit" value="Submit" /></p> </form>