$tablename="info ";
$pageSize=30;
$goPage=$goPage;
if (trim($goPage)==""){$goPage=2;}
$selcetFields="id,title,post_time ";
while (list($k,$v)=each($array_kind)){
$sqlConditions.=" or kind='$v' ";
}
if (trim($sqlConditions)!="") {$sqlConditions="(".substr($sqlConditions,3).")";}
$sqlConditions.=" and flag='Y' ";
$sqlOrders=" order by id desc";
$url="$PHP_SELF?$oriVARS"; //===
//返回第一条记录位置、总行数、当前页码和总页码
list($firstRow,$totleRows,$currentPage,$totalPages)=
divpage($tablename,$sqlConditions,$totleRows,$pageSize,$goPage);
//建立并执行查询语句
$strQuery="select $selcetFields from $tablename ";
if (trim($sqlConditions)!=""){$strQuery.="where $sqlConditions ";}
if (trim($sqlOrders)!=""){$strQuery.=" $sqlOrders";}
$strQuery .=" limit $firstRow, $pageSize ";
$db->query($strQuery);
//===取出数据===
while ($db->next_record()) {
list($id,$title,$post_time)=$db->Record;
$show_time=substr($post_time,5,5); // $show_time=date("m-d",$post_time);
echo "· $title [$show_time] ";
}
?> |
$pageSize){divpage_link($url,$currentPage,$totalPages);} //建立分页连接显示?>
|
|