zoukankan      html  css  js  c++  java
  • 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);
  • 相关阅读:
    C#调用Halcon
    C#跨窗体程序调用方法的具体操作
    C#调用DLL报错:试图加载格式不正确的程序
    C#窗体程序设置禁用关闭按钮
    C#窗体程序设置禁用关闭按钮
    C#在字符串中查询指定字符串是否存在
    poj1654
    poj1873
    poj2451
    poj1113
  • 原文地址:https://www.cnblogs.com/swinm/p/4643407.html
Copyright © 2011-2022 走看看