You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
1.3 KiB

<?php
error_reporting(0);
include '../DB.php';
try {
$conn=new DB();
if($conn){
$account=[];
$latitude=$_REQUEST['latitude'];
$sql="SELECT distinct(customerid) from facility where latitude='$latitude'";
$result=$conn->getAll($sql);
for ($x=0; $x<sizeof($result);$x++) {
$customerid=$result[$x]['customerid'];
$accountsql="SELECT * from account where accountid='$customerid'";
$accountinfo=$conn->getRow($accountsql);
$account[$x]['customerid']= $customerid;
$account[$x]['name']= $accountinfo['name'];
$account[$x]['tel']= $accountinfo['tel'];
$account[$x]['address']= $accountinfo['address'];
$account[$x]['repairerid']= $accountinfo['repairerid'];
}
for ($x=0; $x<sizeof($account);$x++) {
$customerid=$account[$x]['repairerid'];
$accountsql1="SELECT * from account where accountid='$customerid'";
$accountinfo1=$conn->getRow($accountsql1);
$account[$x]['repairername']= $accountinfo1['name'];
$account[$x]['repairertel']= $accountinfo1['tel'];
}
echo json_encode($account);
}
}catch (Exception $e) {
die($e->getMessage());
}
?>