回复 2# 云天一 - function get_all($order = 'id', $offset = 0, $limit = 10)
- {
- global $_SGLOBAL;
- $sql = "SELECT count(*) as num FROM ".tname("app_movie");
- $query = $_SGLOBAL['db']->query( $sql );
- $num = $_SGLOBAL['db']->fetch_array( $query );
- if($num['num'] == 0) return array('total'=>0, 'data'=>array());
- $list = array();
- if($order == 'id'){
- $sql = "SELECT * FROM ".tname("app_movie")." order by $order desc limit $offset, $limit ";
- }else{
- $sql = "SELECT * FROM ".tname("app_movie")." order by has_movie desc, $order desc limit $offset, $limit ";
- }
- $query = $_SGLOBAL['db']->query( $sql );
- while($value = $_SGLOBAL['db']->fetch_array( $query )){
- format_movie($value, 's');
- $list[] = $value;
-
- }
-
- return array('total'=>$num['num'], 'data'=>$list);
- }
复制代码 用的这样的代码,怎么可怎么处理呢? |