<?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);




$phone=$data['phone'];
$user_password= $data['password'];
$table_name=$data['table'];


$sql="SELECT * FROM `{$table_name}` where phone ='{$phone}'
and password ='{$user_password}'";


// echo $sql;

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


if(mysqli_num_rows($result)>0){

    // $ouput=mysqli_fetch_all($result,MYSQLI_ASSOC);
    // echo json_encode(array('list'=>$ouput,'status'=>'1'));

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


}else{

    echo json_encode(array('list'=>'no data found','status'=>'0'));

}


?>