|
|
|
|
 |
connect();
if(!$page) $page=1;
$qry = "SELECT count(*) as sum FROM enews WHERE thid>0";
//$oci->parseExec($qry);
$oci->query($qry);
$result = $oci->fetch();
if ($result) {
$total = $result['sum'];
}
//echo $total;exit;
//$qry1="select thid,title,time from (";
//$qry1 .="select /*+ index_desc(enews thid22_idx) */ rownum as rnum,thid,title,time from enews where thid >0) ";
//$qry1 .="where rnum >= (($page-1)*$cfg->PostNum+1) and (rownum <= $cfg->PostNum)";
//$oci->parseExec($qry1);
$qry1 = "select thid,title,time from enews where thid > 0 order by thid desc limit $cfg->PostNum offset " . ($page-1)*$cfg->PostNum;
//echo $qry1;exit;
//$oci->parseExec($qry1);
$oci->query($qry1);
if($page==1){
$i= $total;
}else{
$i=$total-($page-1)*$cfg->PostNum;
}
if($total>0){
//while ($oci->fetchInto(&$col)) {
$cols = $oci->fetchAll();
//print_r($cols);exit;
foreach($cols as $col) {
$dtime=date("Y-m-d",$col['time']);
$number=$i--;
if(strlen($col['title']) > 45) {
$title=substr($col['title'],0,45)."...";
}else{
$title=$col['title'];
}
$title=stripslashes($title);
?>
|
 |
|
|
|