ecmall 数据库操作

$model为实例化模型对象;

1.查询一条数据

//$id 主键值

$model->get_info($id);

 

2.查询多条数据  并分页

$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.统计数据条数

$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'
));

  

 添加信息成功失败跳转

        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'
        );

 分佣:

$money['money_pt'] = round(0.19 * $order_res['fmoney'],2);

 

转载于:https://www.cnblogs.com/swinm/p/4643407.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值