Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $response = array();
- include 'db_connect.php';
- $db = new DB_CONNECT();
- include 'db_config.php';
- $con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE) or die(mysqli_error($con));
- $result = mysqli_query($con, "SELECT id, username FROM usuario") or die(mysqli_error($con));
- if(mysqli_num_rows($result)>0){
- $response["usuario"] = array();
- while($row = mysqli_fetch_array ($result)){
- $product = array();
- $product['id'] = $row['id'];
- $product['username'] = $row['username'];
- array_push($response["usuario"], $product);
- }
- $response["success"]=1;
- echo json_encode($response);
- }
- else{
- $response["success"]=0;
- $response["message"]="Nenhum usuario cadastrado";
- echo json_encode($response);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement