//初始化页面模版
$oTmpl = new PhpTemplate("./template/colligatenews.php");    //获取当前页数
if(! isset($_GET["page"]))
{
$PageNum = 0;
}
else if(! is_numeric($_GET["page"]))
{
die("<p align='center'><font color='red'>错误!</font></p>");
}
else
{
$PageNum = $_GET["page"];
}    //初始化数据库连接
$o = new Oracle($gDbUser, $gDbPass, $gDbIsp);
if(!$o->HasConnected())
{
die($o->GetLastErrorMsg());
} //查询综合新闻记录
$zhcount = 10;//综合新闻显示条数
$sql = "select dc_title,dn_id,TO_CHAR(DD_DATE,'YYYY-MM-DD HH24:MI:SS') DT , from site_news order by dd_date desc";
$Sql .= "limit ".($PageNum * 10).", 10";
$Rs = $o->Query($sql, 0, $zhcount);
if($Rs === false)
{
echo($o->GetLastErrorMsg());
}    $zhNum = $o->GetAffectedRows();//综合新闻的条数
if ($zhNum == 0)
{
$oTmpl->InsertParag("{%colligatenews%}", "&nbsp;");
$oTmpl->InsertParag("{%news_id%}", "-1");
$oTmpl->InsertParag("{%zhtime%}", "&nbsp;");
}
else 
{
    $oTmpl->RepeatParag("<!--{%RepeatzhxwStart%}-->", "<!--{%RepeatzhxwEnd%}-->", $zhNum - 1);//循环显示
   $i = 0;
   foreach($Rs as $Row)//循环取记录
{
$TmpStr = "";
if(ChsStrLen($Row["DC_TITLE"]) > 30)
{
$TmpStr = SubChs($Row["DC_TITLE"], 0, 29)."...";
}
else
{
$TmpStr = $Row["DC_TITLE"];
}
$oTmpl->InsertParag("{%colligatenews%}", iconv($gDbCharset, "UTF-8", $TmpStr));
$oTmpl->InsertParag("{%news_id%}", $Row["DN_ID"]);
$oTmpl->InsertParag("{%zhtime%}", substr($Row["DT"], 0, 10));
$i ++;
    }
             if($i < 10)
        {
    $oTmpl->InsertAllParag("{%zhtime%}", "&nbsp;");
    $oTmpl->InsertAllParag("{%colligatenews%}", "&nbsp;");
         }
}
     // 查询信息数量情况
$Sql = "select count(*) as TOTAL_PAGES from site_news order by dn_id desc";
$CountRs = $o->Query($Sql);
if($CountRs === false)
{
$o->Destroy();
die("Faild When Query !");
}
// 处理分页情况
$TotalMembers = $CountRs[0]["TOTAL_PAGES"];
$TotalPages = ceil($TotalMembers / 10.0);
if($TotalMembers == 0)
{
$oTmpl->InsertParag("{%Current-Page%}", "0");
}
else
{
$oTmpl->InsertParag("{%Current-Page%}", $PageNum + 1);
}
$oTmpl->InsertParag("{%Total-Page%}", $TotalPages);
    $oTmpl->InsertParag("{%Total-Members%}", $TotalMembers); if($TotalPages != 0)
{
$oTmpl->RepeatParag("<!--{%OptRepeatStart%}-->", "<!--{%OptRepeatEnd%}-->", $TotalPages - 1);
for($i = 0; $i < $TotalPages; $i ++)
{
$oTmpl->InsertParag("{%PageValue%}", $i);
$oTmpl->InsertParag("{%PageNum%}", $i + 1);
if($i == $PageNum)
{
$oTmpl->InsertParag("{%isSelectd%}", "selected");
}
else
{
$oTmpl->InsertParag("{%isSelectd%}", "");
}
}
}
else
{
$oTmpl->DeleteParag("<!--{%OptRepeatStart%}-->", "<!--{%OptRepeatEnd%}-->");
}
if($PageNum > 0)
{
$PrevPage = $PageNum - 1;
}
else
{
$PrevPage = 0;
}
if($PageNum < $TotalPages - 1)
{
$NextPage = $PageNum + 1;
}
else
{
$NextPage = $TotalPages - 1;
} $oTmpl->InsertParag("{%PrevPage%}", $PrevPage);
$oTmpl->InsertParag("{%NextPage%}", $NextPage);
echo($oTmpl->GetContent());
$o->Destroy();
$oTmpl->Destroy();
   以上程序实现分页显示功能,一页10条记录。现在页面报ORA-00936: 和语法错误
   小妹现由网站设计向PHP程序员转向,编程中遇到一些问题,恳请各位哥哥姐姐指教。在此有礼啦!!