$model爲實例化模型對象;php
1.查詢一條數據sql
//$id 主鍵值app
$model->get_info($id);
2.查詢多條數據 並分頁this
$page = $this->_get_page(); $datas = $model->find(array( 'conditions' => '1=1' . $conditions, 'limit' => $page['limit'], 'count' => true, 'order' => 'sort_order', )); $this->_format_page($page); $this->assign('page_info', $page);
3.統計數據條數spa
$count = $model->getCount();
//自定義數據操做 $sql = "UPDATE {$mod_goods->table} " . "SET cate_id_1 = '{$cate_id_n[0]}', cate_id_2 = '{$cate_id_n[1]}', cate_id_3 = '{$cate_id_n[2]}', cate_id_4 = '{$cate_id_n[3]}' " . "WHERE cate_id = '$cate_id'"; $mod_goods->db->query($sql);
$row = $store_mod->get(array( 'conditions' => $param['store_id'], 'fields' => 'store_name' ));
添加信息成功失敗跳轉code
if ($this->_authaccount_mod->get_error()) { $this->show_warning('添加失敗'); //$this->show_warning($this->_authaccount_mod->get_error()); return; } $this->show_message('添加成功', '','index.php?app=my_authaccount' );
分傭:orm
$money['money_pt'] = round(0.19 * $order_res['fmoney'],2);