MMO Starter Kit

Hi guys, I’m having trouble registering data in mysql. He created a new inventory structure, with some aggregate tables, everything works fine, including the reception of data, except that, the insertion of data, the columns that give the index to the table.


<?php

include_once "mmoconnection.php"; 

$mydata = json_decode(file_get_contents('php://input'));

$charid = $mydata ->charid;
$heroeactual = $mydata ->heroeactual;
$inventory = $mydata ->inventory;
$inventario = $mydata ->inventario;
$equipamiento = $mydata ->equipamiento;
$quests = $mydata ->quests;


$stmt = $conn->prepare("DELETE FROM inventario WHERE character_id = ? ");

$stmt->bind_param("i", $charid);

$stmt->execute();

$stmt->close();

So far great, delete the indicated tables.


foreach ($inventario as &$entry) {

    $objeto = $entry->objeto;

    $stmt = $conn->prepare("INSERT INTO inventario VALUES (NULL, ?, ? )");

    $stmt->bind_param("si", $objeto, $charid);

    $stmt->execute();

    $stmt->close();
}

[SPOILER]

[/SPOILER]

I think I am having the problem here, and it must be some small detail that I am not able to see.

[SPOILER]

[/SPOILER]

The data arrives correctly, here is the test:

[SPOILER]


[/SPOILER]

** Finally, the reception of the data towards the database:**

[SPOILER]

[/SPOILER]

I know it works, because other data, in other structures, records them without problems.

Maybe I shouldn’t post this here, but I don’t know where I can post it. What I can do? I simply have this step. I will be very grateful with your advice. A cordial greeting.