日期:2014-05-17  浏览次数:20427 次

函数代码详细求解
请高手帮忙详细解释下段代码
public function fetch_all_by_sql($where, $order = '', $start = 0, $limit = 0, $count = 0, $alias = '') 
{
$where = $where && !is_array($where) ? " WHERE $where" : '';
if(is_array($order)) {
$order = '';
}
if($count) {
return DB::result_first('SELECT count(*) FROM '.DB::table($this->_table).'  %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order));
}
return DB::fetch_all('SELECT * FROM '.DB::table($this->_table).' %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order));
}

------解决方案--------------------
那里不清楚你可以标出来
------解决方案--------------------
public function fetch_all_by_sql($where, $order = '', $start = 0, $limit = 0, $count = 0, $alias = '') 

一个数据库搜索函数,可返回总数量

参数:$where 同sql  WHERE
         $order 同sql  ORDER
          $start 同sql 从哪一条记录开始返回
          $limit 返回多少条记录
           $count 是否直接返回搜索结果记录条数
            alias 不太明白是个什么作用
------解决方案--------------------
不简单看到条正儿八经的的回复

楼上+1