我在我的网页上使用php分页但是在借助于分页php转到第2页后,从最后一页中删除了我要求的变量,并得到错误,
Undefined index: title_no in E:\........\page_name.php on line 7
但是当我使用静态变量时它的工作正常,但是在动态它转到第2页后删除了变量,这是一些我遇到问题的分页代码
ob_start();
@session_start();
include("connect.php");
$title_no=@$_REQUEST['title_no'];
$tbl_name="postadd";
$adjacents = 2;
$productQuery = " where visible='1' AND title_no='{$_REQUEST['title_no']}'";
$query = "SELECT COUNT(*) as num FROM $tbl_name $productQuery";
$total_pages_row = mysql_query($query);
$total_pages_num = mysql_fetch_assoc($total_pages_row);
$total_pages = $total_pages_num['num'];
$targetpage = "product_listing_working.php";
$limit_val = @$_GET['pagesize'];
if($limit_val!='') {
$limit = $limit_val;
} else {
$limit = 3;
}
$page = @$_GET['page'];
if($page)
$start = ($page - 1) * $limit;
else
$start = 0;
$sql = "SELECT * FROM $tbl_name $productQuery LIMIT $start, $limit";
$result = mysql_query($sql);
请指导我出错的地方
提前致谢
答案 0 :(得分:0)
尝试使用
$title_no=@$_GET['title_no'];
编辑1
试试这个
$title_no=@$_GET['title_no'];
var_dump($_GET);//get all variables sent to GET
$tbl_name="postadd";
$adjacents = 2;
$productQuery = " where visible='1' AND title_no='.$title_no.'";//changed concataination to a cleaner way