Created
January 9, 2020 12:22
-
-
Save mdsami/713103a310f8b3c24759f24ed1fe5a5b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| include_once 'connect.php'; | |
| //http://betaussoft.com/appapi/getorder.php?lat=22.5070748&&lon=91.0596610&&dis=1 | |
| $lat=$_REQUEST['lat']; | |
| $lon=$_REQUEST['lon']; | |
| $dis=$_REQUEST['dis']; | |
| $response['receive_data']=array(); | |
| if(!empty($lat) && !empty($lon) && !empty($dis)){ | |
| $sql="SELECT *,3956*2*ASIN(SQRT(POWER(SIN(('$lat' - y_coord)*pi()/180/2),2)+COS('$lat' * pi()/180) | |
| *COS(y_coord * pi()/180)*POWER(SIN(('$lon' - x_coord)* pi()/180/2),2))) | |
| as distance FROM tbl_water where app_status="Approved" having distance < '$dis' ORDER BY distance LIMIT 10"; | |
| /* | |
| $sql="SELECT *,3956*2*ASIN(SQRT(POWER(SIN(('$lat' - x_coord)*pi()/180/2),2)+COS('$lat' * pi()/180) | |
| *COS(x_coord * pi()/180)*POWER(SIN(('$lon' - y_coord)* pi()/180/2),2))) | |
| as distance FROM tbl_water having distance < '$dis' ORDER BY distance"; | |
| while($rows = mysqli_fetch_array($query )) | |
| { | |
| print_r($rows); | |
| } | |
| */ | |
| if($query = mysqli_query($conn, $sql)){ | |
| while ( $row = mysqli_fetch_array($query )) { | |
| $receive_data=array(); | |
| // $receive_data[]=$row; | |
| $receive_data['latitude']=$row['x_coord']; | |
| $receive_data['longitude']=$row['y_coord']; | |
| $receive_data['id']=$row['id']; | |
| $receive_data['created_at']=$row['created_at']; | |
| $receive_data['Landowner']=$row['Landowner'].' '.$row['TW_No']; | |
| $receive_data['TW_No']=$row['TW_No']; | |
| $receive_data['Ward_no']=$row['Ward_no']; | |
| $receive_data['CDF_no']=$row['CDF_no']; | |
| $receive_data['Village']=$row['Village']; | |
| $receive_data['App_date']=$row['App_date']; | |
| $receive_data['Caretaker_male']=$row['Caretaker_male']; | |
| $receive_data['Caretaker_female']=$row['Caretaker_female']; | |
| $receive_data['Technology_Type']=$row['Technology_Type']; | |
| $receive_data['unid']=$row['unid']; | |
| $receive_data['region_id']=$row['region_id']; | |
| $receive_data['proj_id']=$row['proj_id']; | |
| $receive_data['distid']=$row['distid']; | |
| $receive_data['upid']=$row['upid']; | |
| $receive_data['Ward_no']=$row['Ward_no']; | |
| $receive_data['CDF_no']=$row['CDF_no']; | |
| $receive_data['Village']=$row['Village']; | |
| // $receive_data['address']=$row['address']; | |
| // $receive_data['mobile']=$row['mobile']; | |
| // $receive_data['names']=$row['names']; | |
| // $receive_data['addresss']=$row['addresss']; | |
| // $receive_data['mobiles']=$row['mobiles']; | |
| // $receive_data['round']=$row['round']; | |
| // $receive_data['taka']=$row['taka']; | |
| // $receive_data['status']=$row['status']; | |
| // $receive_data['user']=$row['user']; | |
| array_push( $response['receive_data'], $receive_data); | |
| } | |
| $response['success']=1; | |
| echo json_encode($response); | |
| }else{ | |
| $response['success']=0; | |
| echo json_encode($response); | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment