INSERT INTO adds nothing... & Auto Increment

Hello :slight_smile:

I want to create a new database entry using INSERT INTO.
Unfortunately it doesn’t work (there is no new entry in the database), even though I followed the tutorial page.
Even if I make the entry manually in the localhost, the SQL code doesn’t look any different.

No error message is returned, not even in the php_error file. Maybe I just forgot something?
As I understand it, the command is executed with the query, otherwise the tutorial example shouldn’t work either.

The CardID value is Auto Increment and Unique, so I didn’t include it in the INSERT INTO. Is it correct?
Here is the .php code:

<?php

$con = mysqli_connect('localhost', 'root', 'root', 'unityaccess');

//check connection
if (mysqli_connect_errno())
{
echo "Error #1"; // error code #1 = Connection failed!
http_response_code(400);
exit();
}

// $cardID = 11; // Auto Increment
$cardName = $_POST["level7name"];
$username = $_POST["name"];
$score = 0;
$cardLevel = $_POST["level"];
$nos = 0; // nos = Number of Soldiers;
$tmp = 0; // tmp = target manpower
$officerID = 0; // Needs to be unique!!!
$parentID = $_POST["parentID"]; // Get ParentID from Unity!!!

$sql = "INSERT INTO playercards (CardName, nickname, score, Level, NumberOfSoldiers, target_manpower, OfficerID, ParentID) VALUES ($cardName, $username, $score, $cardLevel, $nos, $tmp, $officerID, $parentID)";

if (mysqli_query($con, $sql)) {
echo "New entry successfully.";
}
else {
echo "Error: " . $sql . "
" . mysqli_error($con);
exit();
}

?>

Edit: I saw parts of the SQL code online with ‘…’, but that didn’t help either…
Solved: Forgot to commit…

Best regards
Toby

[ICODE][/ICODE]