Im calling some data from mysql and Im creating my own api to display information in an android app. I tried this video on Youtube but I realized that the person is assuming that we have "page" active in our link, like: google.com/page=1. How can I activate this so I can pass any page number and any amount of items using Android. Again, the problem is not on Android.
I found this on Youtube:
$postData = new WP_Query( array(
    //if the user have passed a page number, it will load this page number
    'posts_per_page' => isset($data['posts']) ? $data['posts'] : 15,
    'paged' => isset($data['page']) ? $data['page'] : 1
));
And this is my function:
function get_all_coin()
{
  
    $servername = "";
    $username = "";
    $password = "";
    $dbname = "";
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    $query = "SELECT * FROM coins LIMIT 100";
    $result = mysqli_query($conn, $query);
    $json = array();
    if (mysqli_num_rows($result) > 0) {
        // output data of each rsow
        while ($row = mysqli_fetch_assoc($result)) {
            $json['id'] = (int) $row['id'];
            $json['name'] = $row['name'];
            // ...(More rows)
            $json_arr[] = $json;
        }
    } else {
        echo "0 results";
    }
    $json_ar = json_encode(['data' => $json_arr]);
    header('Content-type:application/json;charset=utf-8');
    $json_arrd['data'] = $json_arr;
    return $json_arrd;
}
 
    