I am trying to sync an SQLite database to a MySQL server and it seems that the way to do this is to convert the SQLite database to a JSON file and then send it over to PHP to write that into the database. I have created this php file to accept the JSON data:
<?php
include 'databaseconnect.php';
$jsonInput = $_POST['json'];
echo $jsonInput;
$data = json_decode($jsonInput);
foreach($data as $inv){
$id = $inv->id;
$inMillis = $inv->inMillis;
$outMillis = $inv->outMillis;
$complete = $inc->complete;
$sql = "INSERT INTO history (id, inMillis, outMillis, complete) VALUES ('$id', '$inMillis', '$outMillis', '$complete')";
$res = mysqli_query($conn, $sql);
}
?>
I have also managed to convert my data on the android side to a JSON format:
[{"ID":"1","INMILLIS":"1474045680982","OUTMILLIS":"1474046580983","COMPLETE":"1"}]
I am now really struggling to send this data to the PHP file and all of the solutions I can find online don't work. I was wondering if someone could help me find a solution? Thanks!