- 注册时间
- 2015-6-6
- 最后登录
- 1970-1-1
- 阅读权限
- 10
- 积分
- 43
- 精华
- 0
- 帖子
- 5
|
是格式的问题,改正代码如下,希望对存在同样问题的人有所帮助。
function SearchRecord($key,$index, $size, $sortField, $sortOrder){
$conn = createDB();
$sql = "SELECT count(1) FROM YQMX ".$key;
$cursor = oci_parse($conn, $sql);
oci_execute($cursor, OCI_DEFAULT);
$datacount=oci_fetch_row($cursor);
$total = $datacount[0];
$start = $index * $size;
$end = $start+$size + 1 ;
if(!empty($sortField)){
if ($sortOrder != "desc") $sortOrder = "asc";
$order = " order by " . $sortField . " " . $sortOrder;
}else{
$order = " order by yqmc desc";
}
$sql = "select yqmc,yqxh,ccbh from
(select yqmc,yqxh,ccbh,rownum rn
from YQMX ".$key." ) where rn >".$start." and rn< ".$end;
$cursor = oci_parse($conn, $sql);
oci_execute($cursor, OCI_DEFAULT);
$data = array();
while($row=oci_fetch_row($cursor))
{
$row = array("yqmc"=>$row[0],"yqxh"=>$row[1],"ccbh"=>$row[2]);
array_push($data,$row);
}
$resultData = array("total"=>$total,"data"=>$data);
return $resultData;
} |
|