无法进入php中的下一个和上一个记录 [英] Unable to go to next and previous record in php

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

问题描述

大家好,请按下面的编码获取下一个和之前的记录。然而,仍然无法获得下一条记录,因为它显示下一条记录picid = 14,其中实际上下一条记录应该是picid = 40.当前记录是picid = 4。请指教。谢谢。

error_reporting(E_ALL ^ E_NOTICE);

mysql_connect(localhost,user,);

mysql_select_db(pq);

$ _SESSION ['userid'];

$ _SESSION ['username'];

$ _SESSION ['usersecurity'];

//检查起始行变量是否在URL中传递

if(!isset($ _ GET ['picid'])或!is_numeric($ _ GET ['picid'])){

//我们将起始行的值设为0,因为在URL中找不到任何内容

$ _SESSION ['year'];

$ _SESSION ['kra'];

$ _SESSION ['kpi'];

$ _SESSION ['measure'];

$ _SESSION ['target'];

$ picid = 0;

//否则我们从URL中取值

}否则{

$ picid =(int)$ _ GET ['picid'];

}

//这部分是在检查$ _GET var
$ b之后。 $ b $ fetch = mysql_query(SELECT * FROM general,progress LIMIT $ picid,10)或

die(mysql_error());

//现在这是链接..

echo' 下一页 ';

$ prev = $ picid - 10;

//如果单击下一步,则只打印上一页链接

if($ prev> = 0)

echo' 上一页';

?>

Hi everyone, have the coding below to get the next and previous records. However, still unable to get the next record as it shows the next record picid=14, where actually the next record supposed to be picid=40.The current record is picid=4. Please advise. Thanks.
error_reporting(E_ALL ^ E_NOTICE);
mysql_connect("localhost","user","");
mysql_select_db("pq");
$_SESSION['userid'];
$_SESSION['username'];
$_SESSION['usersecurity'];
//check if the starting row variable was passed in the URL or not
if (!isset($_GET['picid']) or !is_numeric($_GET['picid'])) {
//we give the value of the starting row to 0 because nothing was found in URL
$_SESSION['year'];
$_SESSION['kra'];
$_SESSION['kpi'];
$_SESSION['measure'];
$_SESSION['target'];
$picid = 0;
//otherwise we take the value from the URL
} else {
$picid = (int)$_GET['picid'];
}
//this part goes after the checking of the $_GET var
$fetch = mysql_query("SELECT * FROM general,progress LIMIT $picid, 10")or
die(mysql_error());
//now this is the link..
echo 'Next';
$prev = $picid - 10;
//only print a "Previous" link if a "Next" was clicked
if ($prev >= 0)
echo 'Previous';
?>

推荐答案

_SESSION ['userid'];
_SESSION['userid'];


_SESSION ['username'];
_SESSION['username'];


_SESSION ['usersecurity'];

//检查起始行变量是否在URL中传递

if(!isset(
_SESSION['usersecurity'];
//check if the starting row variable was passed in the URL or not
if (!isset(


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

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