I'm creating an android project that receives data from PHP side. But the PHP code gives no result.
I wrote this php code and checked it goes to else loop and shoes no people found . But my SQL query gives output in XAMPP SQL manually.
if($_SERVER['REQUEST_METHOD']=='POST'){
include_once "Dbconnect.php";
$phone= $_POST['phn'];
$sql="Select
peoples.name as pname,
peoples.address as addr,
peoples.phone as phone,
peoples.nomineephone as nphone,
peoples.idproofnumber as idproof,
camp.campid as cid,
camp.Managername as mgrname,
camp.managerno as mgrphone,
camp.name as cname,
camp.Location as loc
from
peoples
inner join camp
on peoples.campid=camp.campid
where
peoples.phone='$phone'";
$result = $conn->query($sql);
if ($result->num_rows >0) {
while($row[] = $result->fetch_assoc()) {
$tem = $row;
$json = json_encode($tem);
}
} else {
echo 'No people data found';
}
echo $json;
}
i tried to echo the phone number in PHP side i got the phone number from android and the data is available in DB with that phone number. But this code not giving the data. I expect the output of the query as json in android