java - Retrieve single Data From MySQL Server DB in Android using Volley and PHP and json
Get the solution ↓↓↓Here PHP code data coming from server but null values how its set everything is works fine without error please explain
if($_SERVER['REQUEST_METHOD']=='GET'){
$id = $_GET['id'];
require_once('dbConnect.php');
$sql = "SELECT * FROM colleges WHERE id='".$id."'";
$r = mysqli_query($con,$sql);
$res = mysqli_fetch_array($r);
$result = array();
array_push($result,array(
"name"=>$res['name'],
"address"=>$res['address'],
"vc"=>$res['vicechancellor']
)
);
echo json_encode(array("result"=>$result));
mysqli_close($con);
}
Answer
Solution:
Change the $sql to the below once and try ....
$sql = "SELECT * FROM colleges WHERE id=$id";
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: property [id] does not exist on this collection instance.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.