I got the instruction to make a database in mysql which stores data from co-workers. The database works perfectly. I made the table which reads the database and theres no problem. However i want to go on and make the formular now.
$sql = "INSERT INTO personaldaten (id, pid, user_status, ue_vorname, ue_nachname, ue_position, ue_firma) VALUES ('3', '$pnr', '1', '$vn', '$nn', '$pst', '$firma')";
This is the query i am using, i have looked for a long time but i haven't found anything thats wrong. Maybe its in the other code?
$db = new mysqli('XXXXX', 'XXXXX', 'XXXXX', 'XXXXX');
if($db->connect_error){
die('Connect Error('.$db->connect_error.')'.$db->connect_error);
}
$sql = "INSERT INTO personaldaten (id, pid, user_status, ue_vorname, ue_nachname, ue_position, ue_firma) VALUES ('3', '$pnr', '1', '$vn', '$nn', '$pst', '$firma')";
if (mysqli_query($db, $sql)) {
echo "Erfolg!";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($db);
Would be glad if someone could help :D
UPDATE:
The Error i get is:
Duplicate entry '3-123456' for key 'PRIMARY'