Hello everyone I'm trying to develop an android app.
I tried to connect the app to the remote mysql server with php using axios (it works when i run the code with vuejs on web.)
here is the Vue-native code;
fetchAllData:function(){
axios.post('db.php', {
action:'fetchall'
}).then(function(response){
app.allData = response.data;
});
here is the db.php file:
$received_data = json_decode(file_get_contents("php://input"));
$data = array();
if($received_data->action == 'fetchall')
{
$query = "
SELECT * FROM users ";
$statement = $connect->prepare($query);
$statement->execute();
while($row = $statement->fetch(PDO::FETCH_ASSOC))
{
$data[] = $row;
}
echo json_encode($data);
}
and here is the error: