我一直在嘗試寫代碼插入到不同的表,但它一直給我上線23在線23
這是一個大學項目登記表錯誤SQL PHP形式的錯誤。
<?php
$con = mysql_connect(","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("HNDGeorgeMason", $con);
$firstname=$_POST['firstname'];
$surname=$_POST['surname'];
$username=$_POST['username'];
$password=$_POST['password'];
$address=$_POST['address'];
$postcode=$_POST['postcode'];
$userid=$_POST['userid'];
$type=$_POST['type'];
switch ($_POST['type'])
{
case guides
$sql="INSERT INTO Guides (firstname, surname, type, username, password)
VALUES ('$firstname', '$surname', '$type', '$username', '$password')";
case parents
$sql="INSERT INTO Parents (firstname, surn ame, type, username, password)
VALUES ('$firstname', '$surname', '$type', '$username', '$password')";
case leaders
$sql="INSERT INTO Leaders (firstname, surname, type, username, password)
VALUES ('$firstname', '$surname', '$type', '$username', '$password')";
}
mysql_close($con);
?>
什麼是錯誤? – Aziz
解析錯誤:語法錯誤,在第23行的/home/taxiedin/public_html/oban/php/reg.php中出現意外的T_VARIABLE –
還檢查您的案例父母可能有姓氏代替surn ame。 –