Here i have made an MySQL which has the columns of "id","name","username","email",age" . Where even i made the the PHP code to retrieve the data for the given id.
eg:if the user enter id=3 then it shows the datas corresponding to the id.
But now i want set multiple inputs so that user can type more than one id and it list the corresponding datas of the particular id.
My PHP Code:
<?php
if($_SERVER['REQUEST_METHOD']=='GET'){
$id = $_GET['id'];
require_once('dbConnect.php');
$sql = "SELECT * FROM user WHERE id='".$id."'";
$r = mysqli_query($con,$sql);
$result = array();
while($res = mysqli_fetch_array($r)){
array_push($result,array(
"id"=>$res['id'],
"name"=>$res['name'],
"username"=>$res['username'],
"email"=>$res['email'],
"age"=>$res['age']
)
);
}
echo json_encode(array("result"=>$result));
mysqli_close($con);
}
Now this URL gives the perfect result: "http://www.allwaysready.16mb.com/Sort.php?id=4"
Now how can i get the corresponding values for the multiple id's?
$idin your query.$workis undefined.