Current location: Hot Scripts Forums » Programming Languages » PHP » Parse error: parse error in C:\wamp\www\smithchr09\Chapter8\ShowBugReport3.php on line 49


Parse error: parse error in C:\wamp\www\smithchr09\Chapter8\ShowBugReport3.php on line 49

Reply
  #1 (permalink)  
Old 07-25-10, 12:20 AM
uctkesmitty uctkesmitty is offline
New Member
 
Join Date: Jul 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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
PHP Code:

<?php
$ShowForm
=FALSE;
$Fields = array('product_name''version''hardware''system''frequency''solutions') ;
$Count = array();
    foreach (
$Fields as $Field
        
$Count[$Field]="";
    if (isset(
$_POST['CountID'])) {
        
$CountID=$_POST['CountID'];
        
        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>

<?php

Last edited by job0107; 07-26-10 at 12:48 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-26-10, 12:46 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
The line in question probably should look like this:
PHP Code:

if( (!isset($_POST[$Field])) || (strlen(trim($_POST[$Field]))) == ){ 

__________________
Jerry Broughton

Last edited by job0107; 07-26-10 at 12:49 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving division chiragkhunti CSS 5 03-19-09 01:47 PM
No error message... stormshadow PHP 3 12-11-06 07:31 PM
Redirection back to a page from form submit DAL Perl 11 03-21-05 03:45 PM
I most definately suggest DevelopingCentral.com For Any Website Design/Development! Salty777 General Advertisements 2 10-01-04 05:27 AM
asp-iis-Server error nsuresh_rasr ASP.NET 3 02-08-04 01:47 AM


All times are GMT -5. The time now is 02:06 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.