<?php

// Created by Ilhomjon on 06.03.2021
header('Content-type: text/html; charset=UTF-8');
require "connect.php";

$sql = "SELECT xozirgi_kurs FROM dollar_kursi ORDER BY time_update DESC LIMIT 1";

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

$result = mysqli_query($conn, $sql);

$count=1;

$list_kurs = array();

if ($result !== false && $result->num_rows > 0) {
    while($row=mysqli_fetch_array($result)){

        $xozirgi_kurs = $row['xozirgi_kurs'];

         array_push($list_kurs,
            array(
                    'xozirgi_kurs' => $xozirgi_kurs,
                 )
                );

    	$count++;
	}

}
 
echo json_encode($list_kurs);
$conn->close();
?>




