Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can someone explain this error to me

    I have an mysql database and a form which post the results to this database. I'm getting this error when I'm clicking on submit. I'm a begginer at php so I'm not that key on whats going on. This is the error I'm getting.

    Parse error: parse error, unexpected T_STRING in C:\FoxServ\www\post_results.php on line 13

    This is my post_results.php code:

    PHP Code:
    <?php
    define 
    ('DB_USER''user'); 
    define ('DB_PASSWORD'''); 
    define ('DB_HOST''localhost'); 
    define ('DB_NAME''labuse'); 

    $dbc = @mysql_connect (DB_HOSTDB_USERDB_PASSWORD) OR die ('Could not connect to MySQL: ' mysql_error() ); 
    mysql_select_db (DB_NAME) OR die ('Could not select the database: ' mysql_error() ); 

    $sql "INSERT INTO compasstime VALUES ('".$_POST['date']."', '".$_POST['grade']."', '".$_POST['teacher']."', '".$_POST['resource']."',
     '"
    .$_POST['res_use']."', '".$_POST['elapsed_time']."');

    echo '<p>The data has successfully been posted to the database. To go back to the form page please <a href="
    resource.html">click here</a></p>';

    ?>
    Any help somone could give me would be greatly appreciated.

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    You are missing a closing double quote at the end here:

    PHP Code:
    $sql "INSERT INTO compasstime VALUES ('".$_POST['date']."', '".$_POST['grade']."', '".$_POST['teacher']."', '".$_POST['resource']."', 
    '"
    .$_POST['res_use']."', '".$_POST['elapsed_time']."')"
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •