我在我的主屏幕上添加了一条保存在我的mysql数据库中的新闻文章。我打算使用箭头按顺序显示下一篇/上一篇文章。我怎么做到这一点?
<?php
function custom_echo($x, $length)
{
if(strlen($x)<=$length)
{
echo $x;
}
else
{
$y=substr($x,0,$length) . '...';
echo $y;
}
}
$query = $handler->query('SELECT * FROM articles');
$results = $query->fetchAll(PDO::FETCH_ASSOC);
for ($i=0; $i < 1; $i++) {
echo '<div class="col-lg-6 col-xs-12 col-sm-12 height-news22">';
echo '<h2 class="ashu">Latest News</h2>';
echo '<br>'.'<p class="news-title78">'.$results[$i]['headline'].'<br>'.'< /p>';
echo '<img class="news-img33" src="data:image/png;base64,'.base64_encode( $results[$i]['logo'] ).'"/>';
echo '<p class="news-time">'.$results[$i]['dateTime'].'<br>'.'</p>'.'<p class="news-body6">';
custom_echo ($results[$i]['text'], 190);
echo '</p>'.'<br>'.'<a href="news.php">'.'<button id="solo-buttons67"> Read More</button>'.'</a>';
echo '<i id="arrow20" class="fa fa-chevron-left fa-1x"></i>'.'<i id="arrow21" class="fa fa-chevron-right fa-1x"></i>'.'</div>';
}
?>