所以我收到了这个错误:
Parse error: syntax error, unexpected '=' in C:\wamp\www\insert_data.php on line 9
在这一行:
$std-id = $_POST['std_id'];
我的PHP代码是:
<?php
if ( isset($_POST['submitted'] ) )
{
include ('mysql_connect.php') ;
$std-id = $_POST['std_id'];
$std-name = $_POST['std_name'];
$std-year = $_POST['year'];
$std-degree = $_POST['degree'];
$sqlinsert = "INSERT INTO student ( ID , Name , Year , Degree ) VALUES (' $std-id ' , ' $std-name ' , ' $std-year ' , ' $std-degree ' ) ";
if (!mysql_query ( $dbcon, $sqlinsert ) ) {
die( ' error inserting new record ' ) ;
} // end of nested if statment
$newrecord = " 1 record added to the database " ;
} // end of the main if statement
?>