PHP报错写着couldn't fetch mysqli
<html><body><formmethod="post">Name:<inputtype="text"name="Name"><br>PhoneNumber:<inp...
<html>
<body>
<form method="post">
Name: <input type="text" name="Name"><br>
Phone Number: <input type="text" name="Number"><br>
<input type="submit">
</form>
<?php
session_start();
echo $name = $_POST["Name"];
echo $number = $_POST["Number"];
echo $sql = "INSERT INTO contacts (Name, Numbers)
VALUES ('" . $name . "', " . $number . ")";
if ($_SESSION["connect"]->query($sql) === true) {
echo "Success";
}
else {
echo "Fail: " . $_SESSION["connect"]->error;
}
?>
</body>
</html>
码在上面,不知道为什么$_SESSION["connect"]出了问题,报了下面这个错:
各路大神帮忙看一看吧。
$_SESSION["connect"]是这么出来的: 展开
<body>
<form method="post">
Name: <input type="text" name="Name"><br>
Phone Number: <input type="text" name="Number"><br>
<input type="submit">
</form>
<?php
session_start();
echo $name = $_POST["Name"];
echo $number = $_POST["Number"];
echo $sql = "INSERT INTO contacts (Name, Numbers)
VALUES ('" . $name . "', " . $number . ")";
if ($_SESSION["connect"]->query($sql) === true) {
echo "Success";
}
else {
echo "Fail: " . $_SESSION["connect"]->error;
}
?>
</body>
</html>
码在上面,不知道为什么$_SESSION["connect"]出了问题,报了下面这个错:
各路大神帮忙看一看吧。
$_SESSION["connect"]是这么出来的: 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询