输出就是
5
4
3
2
1
然后查询id=2的记录在第几页。
其中的MySQL操作代码
set @mycnt = 0; select * from (select (@mycnt:=@mycnt+1) as rownum,id from coupon order by id desc) as a where id=2;
---
转载请注明本文标题和链接:《前端分页后知道mysql数据ID在哪一页》
然后查询id=2的记录在第几页。
其中的MySQL操作代码
set @mycnt = 0; select * from (select (@mycnt:=@mycnt+1) as rownum,id from coupon order by id desc) as a where id=2;
---
转载请注明本文标题和链接:《前端分页后知道mysql数据ID在哪一页》