我一直在尝试编写代码以插入不同的表,但它在第 23 行一直给我错误。
这是一个大学项目登记表。
<?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);
?>