我有这个代码将数据INSERT到mysql表中。对我来说一切似乎都没关系,因为我刚刚编辑了另一个具有相同列名的表中的代码,但是这个代码给出了错误。
// Escape user inputs for security
$facultyid = mysqli_real_escape_string($link, $_REQUEST['facultyid']);
$coursename = mysqli_real_escape_string($link, $_REQUEST['coursename']);
$coursecode = mysqli_real_escape_string($link, $_REQUEST['coursecode']);
$level = mysqli_real_escape_string($link, $_REQUEST['level']);
$semester = mysqli_real_escape_string($link, $_REQUEST['semester']);
$year = mysqli_real_escape_string($link, $_REQUEST['year']);
$cee = mysqli_real_escape_string($link, $_REQUEST['cee']);
// attempt insert query execution
$sql = "INSERT INTO courses (facultyid, coursename, coursecode, level, semester, year, cee)
VALUES ('$facultyid', '$coursename', '$coursecode', '$level' '$semester', '$year', '$cee')";
任何帮助?
答案 0 :(得分:3)
您错过了“$ level”'' $ semester'
之间的昏迷(,)VALUES ('$facultyid', '$coursename', '$coursecode', '$level', '$semester', '$year', '$cee')";