<?php

// Created by Olloyor Abdullayev on 06.03.2021


        require_once('connect.php');

        mysqli_set_charset($conn,"utf8");
        $query = mysqli_query($conn,"SET NAMES utf8");

        $query = mysqli_query($conn, "SELECT Id, pos_id, fio, qarzi_som, qarzi_val, telefon FROM yuk_beruvchilar");

        $list_pas = array();

        if ($query !== false && $query->num_rows > 0) {

        while($row = mysqli_fetch_assoc($query)){

                $fio=$row['fio'];
                $pos_id=$row['pos_id'];
                $telefon=$row['telefon'];
                $qarzi_som=$row['qarzi_som'];
                $qarzi_val=$row['qarzi_val'];
                $fio = str_replace('"', '`', $fio);

                array_push($list_pas,
                array(
                        'fio' => $fio,
                        'pos_id' => $pos_id,
                        'telefon' => $telefon,
                        'qarzi_som' => $qarzi_som,
                        'qarzi_val' => $qarzi_val
                     )
                );
            }
        }

echo json_encode($list_pas);
$conn->close();
?>
