diff --git a/Sources/php_script/script/insertAndMakeListUser.php b/Sources/php_script/script/insertAndMakeListUser.php index 2c1db3e..270ebd7 100644 --- a/Sources/php_script/script/insertAndMakeListUser.php +++ b/Sources/php_script/script/insertAndMakeListUser.php @@ -37,7 +37,6 @@ function insertUserAndReturnList(): array|int );"; mysqli_query($res, $query); - if (!empty($_POST)) { //Check if the method POST return something $id = $_POST['id']; //Get the result of POST method @@ -56,7 +55,7 @@ function insertUserAndReturnList(): array|int $query = "SELECT id FROM gps WHERE id = '$id' "; $results = mysqli_query($res, $query); //Execute the SQL command - if (empty($results)){ + if (empty($results->fetch_row()[0])){ $query = "INSERT INTO gps(id,latitude,longitude,idMusic,dateLog) VALUES('$id','$latitude','$longitude','$idMusic',CURRENT_TIMESTAMP);"; //Insert into the database the new data and new information about this user @@ -87,10 +86,7 @@ function insertUserAndReturnList(): array|int } } - if (!empty($listUser)){ - return 2; - } - return 3; //Return an array + return $listUser; //Return an array } else { //If the method POST return nothing diff --git a/Sources/php_script/script/test.php b/Sources/php_script/script/test.php new file mode 100644 index 0000000..7356de6 --- /dev/null +++ b/Sources/php_script/script/test.php @@ -0,0 +1,7 @@ +