aboutsummaryrefslogtreecommitdiffstats
path: root/php/save-data.php
diff options
context:
space:
mode:
authorMaksymilian Jopek <maks@jopek.eu>2023-03-26 18:31:50 +0200
committerMaksymilian Jopek <maks@jopek.eu>2023-03-26 18:31:50 +0200
commit5aa7c4f9499135dd12162045e441f5215ee050aa (patch)
tree4f95f9f2daedb0053a0b6a95a8e354d76b3c115d /php/save-data.php
downloadcalendrier-menstruel-5aa7c4f9499135dd12162045e441f5215ee050aa.tar.gz
calendrier-menstruel-5aa7c4f9499135dd12162045e441f5215ee050aa.tar.zst
calendrier-menstruel-5aa7c4f9499135dd12162045e441f5215ee050aa.zip
Full working app
Diffstat (limited to 'php/save-data.php')
-rw-r--r--php/save-data.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/php/save-data.php b/php/save-data.php
new file mode 100644
index 0000000..f8c56bb
--- /dev/null
+++ b/php/save-data.php
@@ -0,0 +1,11 @@
+<?php
+$new_data = json_decode(file_get_contents("php://input"), true);
+$user = 'clientApps';
+$pass = 'clientApps';
+$db = 'ClientApps';
+$out = [];
+
+$pdo = new PDO("mysql:dbname=$db;host=localhost;charset=utf8mb4", $user, $pass);
+$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+$stmt = $pdo->prepare("UPDATE chart_x SET data = :data WHERE id = :id");
+$stmt->execute($new_data);