Answer the question
In order to leave comments, you need to log in
What are the implementations of sending push notifications to an Android application?
I am making an application that should receive push notification messages. I use Firebase for push notifications . Messages are sent from the program under windows to the database on the server and notifications are sent. The problem is that notifications do not always arrive instantly (sometimes with a very long delay). Interested in how sending and receiving notifications are arranged in popular instant messengers.
Answer the question
In order to leave comments, you need to log in
You will need LIMIT and OFFSET
Query
SELECT * FROM `video` ORDER BY 'id' LIMIT 5 OFFSET 10
will return the results from eleventh to fifteenth. Limit = how many results to select, offset - how many to skip.$results_per_page = 19;
$page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; // если страница не указана, то будет 1
$limit = $results_per_page;
$offset = $results_per_page * ($page - 1); // для вторй страницы отступ будет 19, для третьей - 38 и так далее.
Link example localhost?limit=19&offset=0
limit - Number of videos
offset- offset
<?PHP
$offset = isset($_GET["offset"])?$_GET["offset"]:0;
$limit = isset($_GET["limit"])?$_GET["limit"]:19;
$movie = mysqli_query($connection, "SELECT * FROM `video` ORDER BY 'id' LIMIT ".$limit." OFFSET ".$offset);
$mov = array();
while($row = mysqli_fetch_array($movie))
array_push($mov,$row);
foreach ($mov as $m): ?>
<li>
<div class="desc">
<a href="#">
<img src="media/img/<?php echo $m['img'].'.jpg' ?>" width="240" height="160"/>
<span class="vieo_time"></span></a>
</div>
<div class="video_name">
<a href="#" title="<?php echo $m['title']; ?>"><?php echo $m['title']; ?></a></div>
<span class="views">Просмотров: <?php echo $m['views']; ?></span>
</li>
<?php endforeach; ?>
<div id="page">
<ul>
<?php
$res = mysqli_query($connection, "SELECT CEILING(COUNT(id)/".$limit.") FROM video");
$len = mysqli_fetch_row($res)[0];
for($i = 0; $i < $len; $i++)
echo "<li><a href='?limit=$limit&offset=".($limit*$i)."'>". ($i + 1)." </a></li>";
?>
</ul>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question