<?php
// Created by Mr. Developer on 15.09.2020
header("Content-type:application/json");

require_once ('connect.php');

$id = $_GET['id'];

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

$query = mysqli_query($conn, "SELECT Id, brend_id, tovar_id, nomi, narxi_naqd, narxi_per, narxi_optom, narxi_nasiya, qoldiq, blok_soni, time, skidka, skidka_eski FROM tovarlar WHERE tovar_id = '" . $id . "'");

$response = array();

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

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

    if($skidka_eski == ""){
        $skidka_eski = "0";
    }

    $nomi = str_replace('"', '`', $nomi);
    $qoldiq = str_replace(',', '.', $qoldiq);
    echo "" . $nomi . "~" . $brend_id . "~" . $narxi_naqd . "~" . $qoldiq . "~" . $time . "~" . $blok_soni . "~" . $skidka . "~" . $skidka_eski . "~";
}
 
?>
