<?
header('Access-Control-Allow-Origin: *'); 

$mysqli = new mysqli("localhost", "afxtech1_myori", "myori2017", "afxtech1_myori");
if ($mysqli->connect_error) {
    die("Connection failed: " . $mysqli->connect_error);
} 

$query = "SELECT * FROM users ";
$dbresult = $mysqli->query($query);

//echo 'Hello...here1';
//die();

$data = [];

while($row = $dbresult->fetch_array(MYSQLI_ASSOC)){
    $data[] = array(
        'apptype' => $row['apptype'],
        'userid' => $row['userid'],
        'password' => $row['password']
    );
}

//echo 'Hello...here2';
//die();
 
if($dbresult){
    //$result = "{success:true, data:" . json_encode($data) . "}";              
    $result = json_encode($data);              
}
else {
    $result = "{success:false}";
}

$mysqli->close();

echo $result;

?>