Fetching data from mysql using Vue

Viewed 23

I am fetching data using PHP API, but am getting this error when i inspect on browser.

'Uncaught (in promise) TypeError: this.getusers is not a function'

below is my code i used fetch.vue

async created(){
  this.getusers();
},
methods:{
getusers(){
  axios.get('http://localhost/vue-project/src/process.php?action=read').then((result)=>{
    console.log(result.data.users);
    this.info = result.data.users;
  }).catch((err)=>{
    console.log(err);
  })
}

process.php

if($action == 'read'){
    $sql = $conn->query("select * from users");
    $users = array();
    while($row = $sql->fetch_assoc()){
        array_push($users, $row);
    }
    $result['users'] = $users;
}

what am i doing wrong? am new in vue.js

0 Answers
Related