heyho, ich hab durch ein tut hinbekommen, über ein formular einen benutzer in die datenbank einzutragen, dies geht aber leider nur einmal, dann kommt der error
Error: Duplicate entry '0' for key 'PRIMARY'
Ich habe auto archivement oder wies heißt bei id drin.
Hab kp woran es liegt, hier der code
PHP
<?php
$con=mysqli_connect("localhost","root","johndeus200","login");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO users (username, password) VALUES ('$_POST[name]','$_POST[passwort]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "Benutzer hinzugefügt";
mysqli_close($con);
?>
Alles anzeigen