我一遍又一遍地查看这些代码,无法确定数据输入的匹配位置。 这可能是格式化问题吗?我以为SET方法可能会起作用 任何帮助将非常感激!
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "theloft";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$st_fn = $_GET["fname"];
$st_ln = $_GET["lname"];
$st_address = $_GET["address"];
$st_city = $_GET["city"];
$st_state= $_GET["state"];
$st_zipcode = $_GET["zipcode"];
$st_dob = $_GET["dob"];
$st_lmuid = $_GET["lmuid"];
$st_type = $_GET["type"];
$st_date = date("m/d/Y");
$st_email = $_GET["email"];
$st_staffnumber = "Online";
$st_phone = $_GET["phone"];
$sql_insert = <<<INSERTSTR
"INSERT INTO loftmember (lmuidnumber, loftstaffnumber, membershipdate, loftmembershiptype, dateofbirth)
VALUES ('$st_lmuid', $st_staffnumber, $st_date, '$st_type', $st_dob);
INSERT INTO lmumember (lmuidnumber, firstname, lastname, address, city, state, zipcode, email, phonenumber, dateofbirth)
VALUES ('$st_lmuid', '$st_fn', '$st_ln', '$st_address', '$st_city', '$st_state', '$st_zipcode', '$st_email', '$st_phone', $st_dob);"
INSERTSTR;
if (mysqli_query($conn, $sql_insert)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql_insert . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>