I am new to php so please guide and don't make it duplicate because i can't get solution from previous solutions.My php code is given below
<?php
if($_SERVER['REQUEST_METHOD']=='GET'){
$city = $_GET['city'];
$town = $_GET['town'];
//$skills=$_POST['skills'];
require_once('DbConnect.php');
//Creating sql query
$sql = "SELECT FROM employees where city='".$city."' and town='".$town."'";
//getting result
$r = mysqli_query($con,$sql);
//creating a blank array
$result = array();
//looping through all the records fetched
while($row = mysqli_fetch_array($r)){
//Pushing name and id in the blank array created
array_push($result,array(
"name"=>$row['name'],
"phone"=>$row['phone'],
"skills"=>$row['skills']
));
}
//Displaying the array in json format
echo json_encode(array('result'=>$result));
mysqli_close($con);
}
?>
ERROR
Notice: Undefined index: city in C:\xampp\htdocs\getServices\employeesInfo.php on line 3
Notice: Undefined index: town in C:\xampp\htdocs\getServices\employeesInfo.php on line 4
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\getServices\employeesInfo.php on line 17 {"result":[]}