gpt4 book ai didi

php - "Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in"

转载 作者:搜寻专家 更新时间:2023-10-30 20:50:20 24 4
gpt4 key购买 nike

<分区>

我从包含我的数据库的虚拟主机那里收到这些警告。我正在尝试让在 Android Studio 中开发的 Android 应用程序将数据从 Register user activity 发送到数据库。我想我遇到了 PHP 脚本错误。

下面是我注册用户的PHP代码:

<?php
$con = mysqli_connect("localhost", "user", "pass", "db");

if (isset($_POST["name"], $_POST["email"], $_POST["username"], $_POST["password"]))
{
$name = $_POST["name"];
$email = $_POST["email"];
$username = $_POST["username"];
$password = $_POST["password"];
}

$statement = mysqli_prepare($con, "INSERT INTO user (name, username, email, password) VALUES (?, ?, ?, ?)");
mysqli_stmt_bind_param($statement, "siss", $name, $username, $email, $password);
mysqli_stmt_execute($statement);

$response = array();
$response["success"] = true;

echo json_encode($response);
?>

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