gpt4 book ai didi

在 MySQL 连接的数据库中插入一行时的 PHP 错误代码

转载 作者:太空宇宙 更新时间:2023-11-03 12:00:12 25 4
gpt4 key购买 nike

<分区>

( ! ) Parse error: syntax error, unexpected '"', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\wamp\www\mystore\customer.php on line 33

<html>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "goodoneboy";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
<?php
$servername = "localhost";
$username = "root";
$password = "goodoneboy";
$dbname = "my store";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo $_POST["name"];
echo $_POST["address"];
echo $_POST["amount_paid"];
$sql = "INSERT INTO customer (Name,Address,Amount_paid)
VALUES ('$_POST["name"]','$_POST["address"]',' $_POST["amount_paid"]')";

if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
?>
</body>
</html>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com