View Full Version : Can someone explain this error to me

05-11-2004, 04:15 AM
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:

define ('DB_USER', 'user');
define ('DB_PASSWORD', '');
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'labuse');

$dbc = @mysql_connect (DB_HOST, DB_USER, DB_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.

05-11-2004, 04:51 AM
You are missing a closing double quote at the end here:

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