• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help [ANDROID] Why my host getting problem when communicate with Android app?

FlixYudhz

Lurker
i try to displaying value of my table in android, and i put my code into hosting, but when i try to running my app, my link doesn't work,

and i tried to create new link that displays the same output , and its works fine,

this is my code to encode json

PHP:
<?php
    include 'dbconfig.php';
    $con = new mysqli($servername, $username, $password, $dbname);
    if (mysqli_connect_errno()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

    $query = "select id,ask from pertanyaan";

    $result = mysqli_query($con, $query);


    while ($r = mysqli_fetch_array($result)) {
        extract($r);
   $rows[] = array(
    "id"=>$id,
   "ask"=>$ask
      );
    }
   header('Content-Type: application/json');
     echo json_encode($rows);

    mysqli_close($con);
?>

did I'm doing something wrong?? because I want to set the output from the database
 
Back
Top Bottom