所以这里有很多问题
1-虽然不确定,但是
Currenlty I have 3 records in table related to id 1
似乎是不正确的说法。如果
id
是主键,不能对一个记录有3个记录
身份证件
二-
$stmt->get_result()->fetch_assoc();
将始终返回一行,若要获取多行或行集合,则需要按如下方式执行
if ($result = $mysqli->query($query)) {
while ($row = $result->fetch_assoc()) {
printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);
}
$result->free();
}
3-从下面的代码可以很清楚地看出,实际上您只返回了一行
if ($applications) {
$response["status"] = 0;
$response["id"] = $applications["id"];
$response["application_id"] = $applications["application_id"];
$response["requested_amount"] = $applications["requested_amount"];
$response["interest_per_day"] = $applications["interest_per_day"];
$response["gst"] = $applications["gst"];
$response["tenure"] = $applications["tenure"];
$response["processing_fees"] = $applications["processing_fees"];
$response["amount_user_get"] = $applications["amount_user_get"];
$response["amount_user_pay"] = $applications["amount_user_pay"];
$response["application_latitude"] = $applications["application_latitude"];
$response["application_longitude"] = $applications["application_longitude"];
$response["application_status"] = $applications["application_status"];
$response["created_at"] = $applications["created_at"];
$response["updated_at"] = $applications["updated_at"];
$response["message"] = "Applications details fetched successfully";
echo json_encode($response);
}
你应该这样做
$applications = getAllApplications();
$response['applications'] = $applications;
return json_encode($response);