<?php

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


 
$umum_soni = 0;

$sql = "SELECT Id, menu_id, tovar_id, nomi, narxi_naqd, narxi_per, qoldiq, blok_soni, time, narxi_optom, narxi_nasiya FROM tovarlar WHERE qoldiq > 0";

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

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

$count=1;
$list_gruppalar = array();

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

		$Id=$row['Id'];
		$menu_id=$row['menu_id'];
		$tovar_id=$row['tovar_id'];
		$nomi=$row['nomi'];
		$narxi_naqd=$row['narxi_naqd'];
		$narxi_per=$row['narxi_per'];
		$qoldiq=$row['qoldiq'];
		$blok_soni=$row['blok_soni'];
		$time=$row['time'];
        $narxi_optom=$row['narxi_optom'];
        $narxi_nasiya=$row['narxi_nasiya'];

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

		echo ''.$Id.'^'.$menu_id.'^'.$tovar_id.'^'.$nomi.'^'.$narxi_naqd.'^'.$narxi_per.'^'.$qoldiq.'^'.$blok_soni.'^'.$time.'^'.$narxi_optom.'^'.$narxi_nasiya.'~';

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

if($count == 1){

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

	$conn->close();
	return;
}
$conn->close();
?>
