I create a web service (API) using PHP I am trying to display all records of my database table using array via JSON and xml but it is only display one record or it is getting respond for only one record. Any idea would be useful.
Thanks
$query = "SELECT * FROM students";
$result = mysqli_query($con, $query);
while($rows = mysqli_fetch_array($result))
{
$fullrecord = $rows['ID'] . " " . $rows['StudentName'] . " " . $rows['Age'];
$response['data'] = $fullrecord;
}
//Return Response to browser
deliver_response($_GET['format'], $response);
No comments:
Post a Comment