Answer the question
In order to leave comments, you need to log in
Error writing user to database, what to do?
Here is the script itself:
if(isset($_SESSION["steamid"])) {
$loggedIn = true;
$steamid = $_SESSION["steamid"];
$nickname = $_SESSION["personaname"];
$avatarfull = $_SESSION["avatarfull"];
mysqli_query($connect, "INSERT INTO users (steamid, name, avatar) VALUES ('$steamid', '$nickname', '$avatarfull')");
}
else {
$loggedIn = false;
}
Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Duplicate entry '76561198131980154' for key 'PRIMARY'' in C:\OpenServer\domains\localhost\index.php:26 Stack trace: #0 C:\OpenServer\domains\localhost\index.php(26): mysqli_query(Object(mysqli), 'INSERT INTO use...') #1 {main} thrown in C:\OpenServer\domains\localhost\index.php on line 26
Answer the question
In order to leave comments, you need to log in
You also wrote: Duplicate entry '76561198131980154' for key 'PRIMARY'' - an entry with the key 76561198131980154 already exists in the database. Decide on the logic of work. Use Insert or Update or Insert ignore
The bracket is not closed. It should be like this:'$avatarfull')");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question