<?php

// Created by Ibrohimjon Ahmadjonov Ilhomjon o'g'li on 08.02.2020
header('Content-type: text/html; charset=UTF-8');
require "connect.php";


 
$sql = "SELECT dok.Id AS Id, dok.region_id AS region_id, dok.dokon_id AS dokon_id, dok.dokon_nomi AS dokon_nomi, dok.qarzi AS qarzi, dok.time AS time, dok.manzil, dok.telefon1, dok.telefon2, dok.yatt, dok.latitude, dok.longitude FROM dokonlar AS dok";

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

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

$count=1;

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

		$Id=$row['Id'];
		$region_id=$row['region_id'];
		$dokon_id=$row['dokon_id'];
		$nomi=$row['dokon_nomi'];
		$qarzi=$row['qarzi'];
		$time=$row['time'];
      $manzil=$row['manzil'];
      $tel1=$row['telefon1'];
      $tel2=$row['telefon2'];
      $yatt=$row['yatt'];
      $latitude=$row['latitude'];
      $longitude=$row['longitude'];

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

		echo ''.$Id.'^'.$region_id.'^'.$dokon_id.'^'.$nomi.'^'.$qarzi.'^'.$time.'^'.$manzil.'^'.$tel1.'^'.$tel2.'^'.$yatt.'^'.$latitude.'^'.$longitude.'~';

		$count++;
	}
	if($count > 1){
		$conn->close();
		return;
	}
}

if($count == 1){

	echo "no_c";
	$conn->close();
	return;
} else{

	$conn->close();
	return;
}

$conn->close();
?>
