繁体   English   中英

PDO分页-指向上一页/下一页的链接不正确

[英]PDO Pagination - link to previous/next page not correct

我只是在我的网站上添加了php分页,但是我没有设法链接到正确的页面。

背景资料:

人们可以在“ example.com/bikebrands.php”页面上选择自行车品牌。 因此,当他们选择“ Bianchi”时,它将打开网页“ example.com/bikebrands/bianchi”,并在我的数据库中列出该品牌的所有相关新闻报道。

我必须设置目标页面才能使分页工作。 我选择了“ / bikebrands”,但这是不正确的。 它应该是:

$targetpage = "/bikebrands/**(echo row "bike brand" from database depending on the bike brand the visitor has selected)**?page=2";

因此,当有人打开: example.com/bikebrands/bianchi并单击“下一步”时,它应该加载example.com/bikebrands/bianchi?page=2

当有人打开: example.com/bikebrands/trek并单击“下一步”时,它应该加载example.com/bikebrands/trek?page=2

页面example.com/bikebrands/bianchi?page=2存在,因此url本身没有问题,只是我没有设法链接到该页面。

我该如何实现?

假设品牌只是另一个参数,您是否无法使用$_GET['brand']或给出的任何名称来检索它?

$targetpage = "/bikebrands/" . $GET['brand'] . "?page=" . $next;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM