R & D

Develop an application using PHP and MySQL for finding positions in a given cycle area using given postal code based on latitude and longitude.

1. give the POSTAL-CODE and RADIUS as input.
2. using that postal-code find the latitude and longitude for the postal-code.
3.find the positions in given cycle area using above result.
4. display above result on a able

you can make a simple form to input postal code and radius. according to my program i add radius in Kilo miters.

public function getcenter($post) {
include 'connect.php';/*to connect with database*/
if (isset ( $_REQUEST ['postcode'] ) & ! mysqli_connect_errno ()) { /*if there is not database connection error and there is a input as postcode*/
$postcode = $_REQUEST ['postcode'];/*define variable as poscode and assign inpu postcode*/
$query = "SELECT id,latitude,longitude FROM postcodelatlng  WHERE postcode='" . $postcode . "'";/*query for getting sensory column values of the input*/
$result = mysqli_query ( $con, $query );/*run the sql query and store the row walues on the result variable*/

$rowno = mysqli_num_rows ( $result );/*count number of rows in above results*/
$row = mysqli_fetch_row ( $result );/*we now we have given one postal code as input, so result contain only one row. I add that in to mysql fetch row here*/
if ($row != 0) {/*if there is a row, otherwise we have input valid post code*/
return array (/*return this array*/
'latlang' => $row,
'radius' => $_REQUEST ['distance'],
'postcode' => $postcode
);
} else/*otherwice return 0*/
return 0;
}
}

No comments:

Post a Comment