我用分层做一个雇员管理系统,写到雇员分页那里的时候怎么会有这样的提示:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '6' at line 1
俺表示从来没有见过,是哪里出问题了,需要怎么修改呢?
<?php
require_once 'SqlHelper.class.php';
class EmpService{
//设置获取$pageCount,共有多少页
function getpageCount($pageSize){
$sql="select count(id) from emp";
$sqlHelper=new SqlHelper();
$res=$sqlHelper->execute_dql($sql);
if($row=mysql_fetch_row($res)){
$pageCount=ceil($row[0]/$pageSize);
}
mysql_free_result($res);
mysql_close();
return $pageCount;
}
//设置应该显示出来的雇员信息
function getempLiseByPage($pageSize,$pageNow){
$sql="select * from limit".($pageNow-1)*$pageSize.",$pageSize";
$sqlHelper=new SqlHelper();
$res=$sqlHelper->execute_dql($sql);
//释放资源关闭连接
mysql_free_result($res);
$sqlHelper->close_connect();
return $res;
}
}
?>
------解决方案--------------------
- PHP code
$sql="select * from limit ".($pageNow-1)*$pageSize.",$pageSize";