This is my Error:
Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of variables doesn't match number of parameters in prepared statement in /Applications/XAMPP/xamppfiles/htdocs/Jil/benutzer_eintragen.php on line 19
and this is my Code
$sql = "INSERT INTO benut开发者_开发技巧zer SET vorname='?', nachname='?', username='?', email='?', passwort='?';";
$stmt = $db->prepare($sql);
$stmt->bind_param("sssss", $vorname, $nachname, $username, $email, $passwort);
$stmt->execute();
I think you need to eliminate the quote marks in the statement:
$sql = "INSERT INTO benutzer SET vorname=?, nachname=?, username=?, email=?, passwort=?;";
You don't need the quotes around the ?
in the SQL statement.
Also, your SQL statement is incorrect. SET
is only used with UPDATE
, INSERT
uses VALUES
.
$sql = "INSERT INTO benutzer(vorname,nachname,username,email,passwort) VALUES (?,?,?,?,?)";
$sql = "INSERT INTO benutzer SET vorname=?, nachname=?, username=?, email=?, passwort=?";
$stmt = $db->prepare($sql);
$stmt->bind_param("sssss", $vorname, $nachname, $username, $email, $passwort);
$stmt->execute();
精彩评论