Can someone please show me some examples or show me how, I already got the parms working but I don't know how I would do the api what im trying to do is make it get the data from my database with the currentpage and pagesize/limit I have got limit to work but I cant figure out how I would do current page
This is what I've got so far
<?php
require ($_SERVER['DOCUMENT_ROOT']."/core/config.php");
require ($_SERVER['DOCUMENT_ROOT']."/core/session.php");
if ($logged == false) {
header('Location: /');
exit;
}
$limit = mysqli_real_escape_string($conn, $_GET['pageSize']);
if(intval($limit)) {
$sqlSearch = "SELECT * FROM `users` ORDER BY `id` DESC LIMIT $limit";
$result = $conn->query($sqlSearch);
while ($userrows = $result->fetch_assoc()) {
$username = $userrows['username'];
$apiresp = array('success' => "true", 'username' => $username);
echo json_encode($apiresp);
}
}
?>
My Answer:
't understand what you mean by "php - I don't". Can you please provide more context or clarify your question?
Rate this post
5 of 5 based on 8773 votesComments