I have a problem with php pagination. I trying make a list from a db and generate pages. Below there is a part of code. If I am right I can't use limit and offset in my sql server?
$stmt = $conn->prepare('SELECT * FROM db_name ORDER BY use_by_date LIMIT :limit OFFSET :offset');
$stmt->bindParam(':limit', $limit, PDO::PARAM_INT);
$stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$iterator = new IteratorIterator($stmt);
foreach ($iterator as $row) {
echo '<p>', $row['name'], '</p>';
}
}
else {
echo '<p>No results could be displayed.</p>';
}
what is wrong?