implemented functionality to write to Database after game ends

This commit is contained in:
Patryk Hegenberg 2023-01-10 23:13:40 +01:00
parent 03e5591e0a
commit dc99bdcab5
2 changed files with 11 additions and 7 deletions

View file

@ -3,6 +3,10 @@
$password = 'password';
$config = require('config.php');
$db = new Database($config['database'], $username, $password);
$data = json_decode(file_get_contents("php://input"), true);
dd($data);
$db->update($data);
$data = json_decode(file_get_contents("php://input"), true);
$db->query("UPDATE user SET level= :level, xp= :xp, coins= :coins WHERE username = :user", [
"level" => $data["level"],
"xp" => $data["xp"],
"coins" => $data["coins"],
"user" => $data["username"]
]);