$tablename="titles,content ";
$pageSize=30;
$goPage=$goPage;
$selcetFields="id,title,post_time,img_name ";
$sqlConditions="and status='Y' and id=title_id and fromto like '%$fromto%' ";
//$sqlConditions="and status='Y' and id=title_id ";
// if (trim($keywords)!="") {
// $sqlConditions .= " and fromto like '%$keywords%' ";
// }
if (trim($sqlConditions)!="") {$sqlConditions=substr($sqlConditions,3);}
$sqlOrders=" order by id desc";
if ($keywords != "" && $kind != "") {
$url="$PHP_SELF?$oriVARS&keywords=".$keywords."&kind=".$kind ;
}else {
$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 ";
// echo $strQuery;
$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]
";
}
?>