<?php
header ('Content-Type: application/json');
header('Acess-Control-Allow-Origin: *');
header('Acess-Control-Allow-Methods: Post');



include 'confing.php';

$data=json_decode(file_get_contents("php://input"),true);

$retailerid=$data['id'];
$tableName=$data['table'];
$colom=$data['coloum'];



$sql="SELECT * FROM `$tableName` WHERE `$colom` = '{$retailerid}' ORDER BY id DESC";

// echo $sql;

$result=mysqli_query($conn,$sql) or die("error while");


if(mysqli_num_rows($result)>0){

    while($row=mysqli_fetch_array($result, MYSQLI_ASSOC))
    {
         $ouput[]=$row;
          }
    
  
    echo json_encode(array('list'=>$ouput,'status'=>'1'));

   
   

}else{

    echo json_encode(array('list'=>$ouput,'status'=>'0'));

}


?>