I am trying to fix pagnation from API and not the UI.
This is my code :
$app->get('/renterproperties/{state}', function ($request, $response, $args) {
$state = AdjustSql($args['state']);
$lastId = (int) ($request->getQueryParams()['last_id'] ?? 0);
$sql = "
SELECT *
FROM properties
WHERE state_id = '$state'
AND id > $lastId
ORDER BY id
LIMIT 10
";
return $response->withJson(ExecuteRows($sql));
});
My problem now is $lastId = (int) ($request->getQueryParams()['last_id'] ?? 0); how to get the last ID . My code is in Api_Action. phpmaker 2024