I am a beginner in php and I want to submit the inputs to my database using this function. I checked everything including variables, ids.. everything. However, !mysqli_stmt_prepare($stmt, $sql) is always returning true. Means that there is something wrong why it cant store my inputs to my database.
createUser($conn, $name, $email, $username, $pwd);
function createUser($conn, $name, $email, $username, $pwd) {
$sql = "INSERT INTO users (usersName, usersEmail, usersUid, usersPwd) VALUES (?, ?, ?, ?);";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
header ("location: ../signup.php?stmtfailed2");
exit();
}
$hashedPwd = password_hash($pwd, PASSWORD_DEFAULT);
mysqli_stmt_bind_param($stmt, "ssss", $name, $email, $username, $hashedPwd);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
header("location: ../signup.php?error=none");
exit();
}