转到上一个,下一个记录.. [英] go to previous,next records..

查看:63
本文介绍了转到上一个,下一个记录..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,一个名为'hardware''的表只包含5000条记录..一个mysql数据库..用户可以逐个添加,修改或查看这些硬件详细信息..同时单击视图 '按钮,用户被重定向到''hardware_view.php''页面并且可以查看硬件..


我的问题是..当hardware_view.php被加载时,它有从数据库中检索第一条记录并且必须显示值..此页面包含上一个,下一个按钮..同时单击下一个按钮,它必须显示下一条记录,而前一个按钮也一样...怎么做这个?(当页面正在加载时,必须显示记录..并根据下一个,之前的按钮,它必须移动到相应的记录...)

in my project, a table called ''hardware'' contains merely 5000 records..its a mysql database.. the user can add, modify or can view this hardware details one by one.. while clicking ''view'' button, the user is redirected to ''hardware_view.php'' page and can view the hardware..

my question is.. while the hardware_view.php is loaded, it has to retrieve the first record from the db and has to display the values.. this page contains previous, next buttons.. while clicking next button, it has to display the next record and for previous button also the same... how to do this?.(while the page is loading itself, the records has to be displayed.. and according the next,previous buttons it has to move to corresponding records...)

推荐答案

目前,当用户点击视图按钮时,''hardware_view.php''必须具有关于来自Db的项目的当前ID /特定ID以显示其详细信息l。给前一个按钮的链接说(当前ID-1)和下一个按钮(当前ID + 1)。这必须帮助你查询。
At the present when user clicks views button ''hardware_view.php'' must have the current ID/particular ID regarding to the item from the Db to display its details .give the link to the previous button saying (current ID-1) and next button (current ID+1) .This must help u with ur query .


我没有任何ID ..因为,如果我从表中删除任何记录,例如说500,表ID就不存在于表格中....所以在表格记录中,如1,2 ..,499则501 ...等将可用..所以我不能只是增加或减少查看记录..所以我dint有tat field ..
i dont have any ID.. because, if i delete any record from table, for example say 500, tat ID wont exist in the table.... so in table records like, 1,2..,499 then 501...etc will be available.. so i cant just increment or decrement to view the record.. so i dint have tat field..


@sweetline priya


哦确定!!!你总是可以在你的mysql查询结尾说出限制3个ID的ID我猜...这样你就得到3个可用的ID'并更新上一个和下一个按钮。试试这个..
@sweetline priya
oh ok!!! u can always say in your mysql query at the end that limit 3 order by ID i guess....so that u get 3 available ID''s and update the previous and next button.Try this ..


这篇关于转到上一个,下一个记录..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆