第一页正常,第二页就不正常了. 第二页查询到private表去了.怎么会这样,请高手帮忙.根据客户端的选择进行查询. 有一个下拉菜单,让用户选择查询那个表. 如下判断
如果用户选择值为public的菜单,则表名等于public,日期字段名为datetime,否则表名等于private 日期字段名为date_time$select=check_input($_POST['select_1']);
if($select=="public") {
$table="public";
$date="datetime";
} else { 
$table="private";
$date="date_time";
}$cond="where user='$uname'";
if($selname!="") $cond.="and name like '%$selname%'";
if($time!="") $cond.="and to_days($date)=to_days('$time')";
if($start_time!="" && $end_time!="") 
$cond.="and to_days($date)>=to_days('$start_time') and to_days($date)<= to_days('$end_time')";
if($total!="0.00") $cond.="and total='$total'";
if($notes!="") $cond.="and notes like '%$notes%'";//分页程序
if(!isset($_GET['page']))
$page=1;
else
$page=$_GET['page'];
$select_nums="select count(*) from $table $cond";
$st_se_num=@mysql_query($select_nums,$conn);
$select_num=$select_num+1;
$rows_num=mysql_fetch_row($st_se_num);
if(is_numeric($page)) {
$page_size=25;
$pages_count=$rows_num[0]/$page_size;
$pages=ceil($pages_count);
$next=$page+1;
$back=$page-1;
$offset=($page-1)*$page_size;
}$select_sql="select * from $table $cond order by id desc limit $offset,$page_size";//查询语句