<?php

// Created by Mr. Developer on 15.09.2020


require_once('connect.php');

$query = mysqli_query($conn, "SELECT dok.Id AS Id, dok.region_id AS region_id, dok.kontr_id AS dokon_id, dok.kontr_nomi AS dokon_nomi, dok.qarzi_naqd AS qarzi_naqd, dok.qarzi_perech AS qarzi_perech, dok.time AS time FROM kontragentlar AS dok");

$response = array();

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

        $Id=$row['Id'];
		$region_id=$row['region_id'];
		$dokon_id=$row['dokon_id'];
		$nomi=$row['dokon_nomi'];
		$qarzi_naqd=$row['qarzi_naqd'];
		$qarzi_perech=$row['qarzi_perech'];
		$time=$row['time'];

		$nomi = str_replace('"', '`', $nomi);

    array_push($response,
    array(
            'Id' => $Id,
            'region_id' => $region_id,
            'dokon_id' => $dokon_id,
            'dokon_nomi' => $nomi,
            'qarzi_naqd' => $qarzi_naqd,
            'qarzi_perech' => $qarzi_perech,
            'time' => $time
         )
        );
}

echo json_encode($response);

?>

