CasperSecurity
<?php
session_start();
include '../../../web/connection/connectionv2.php';
$item_id = $_REQUEST['item_id'];
if(isset($item_id)){
$db_handle = new DBController();
$selecth=$db_handle-> runQuery("SELECT * FROM (item
INNER JOIN item_group ON item.item_group_id = item_group.item_group_id)
WHERE item.item_id = '$item_id'");
$db_handle = new DBController();
$selecthnum=$db_handle-> numRows("SELECT * FROM (item
INNER JOIN item_group ON item.item_group_id = item_group.item_group_id)
WHERE item.item_id = '$item_id'");
$last_row = $selecthnum - 1;
if($selecthnum >= 1){
echo '{"status": "1",
"data":[';
$i =1;
foreach($selecth as $resulth){
$item_id = $resulth['item_id'];
$brand_id = $resulth['brand_id'];
$db_handle = new DBController();
$khb =$db_handle-> runQuery("SELECT * FROM brand WHERE brand_id = '$brand_id' ");
foreach($khb as $vb) {
}
$db_handle = new DBController();
$khitm =$db_handle-> runQuery("SELECT * FROM item_gst WHERE item_id = ' $item_id' ");
foreach($khitm as $vitm) {
}
$item_group_name = $resulth['item_group_name'];
$item_name = $resulth['item_name'];
$brand_name = $vb['brand_name'];
$item_type= $resulth['item_type'];
$hsn_code= $resulth['hsn_code'];
$item_unit = $resulth['item_unit'];
$composition = $resulth['composition'];
$altmedicine = $resulth['altmedicine'];
$sgst_rate = $vitm['sgst_rate'];
$cgst_rate = $vitm['cgst_rate'];
$igst_rate = $vitm['igst_rate'];
$returnable = $resulth['returnable'];
$item_mrp = $resulth['item_mrp'];
$item_photo1 = $resulth['item_photo1'];
$item_photo2 = $resulth['item_photo2'];
$item_photo3 = $resulth['item_photo3'];
$item_photo4 = $resulth['item_photo4'];
echo'
{
"item_id":"'.$item_id.'",
"item_group_name":"'.$item_group_name.'",
"item_name":"'.$item_name.'",
"brand_name":"'.$brand_name.'",
"item_type":"'.$item_type.'",
"hsn_code":"'.$hsn_code.'",
"item_unit":"'.$item_unit.'",
"composition":"'.$composition.'",
"altmedicine":"'.$altmedicine.'",
"sgst_rate":"'.$sgst_rate.'",
"cgst_rate":"'.$cgst_rate.'",
"igst_rate":"'.$igst_rate.'",
"returnable":"'.$returnable.'",
"item_mrp":"'.$item_mrp.'",
"item_photo1":"'.$item_photo1.'",
"item_photo2":"'.$item_photo2.'",
"item_photo3":"'.$item_photo3.'",
"item_photo4":"'.$item_photo4.'"
}';
if($i <= $last_row){
echo ',';
}
$i++;
}
echo'
]}';
}else{
echo '{"status": "0",
"message":"Page Not found"
}';
}
}
?>