首页 > 数据库技术 > 详细

ecmall数据库基本操作

时间:2014-03-17 23:39:37      阅读:866      评论:0      收藏:0      [点我收藏+]

ecmall数据库基本操作,为了认真研究ecmall二次开发,我们必须熟悉ecamll的数据库结构,ecmall数据库结构研究熟悉之后,才能去认真分析ecamll的程序结构。从而实现ecmall二次开发需求。

    以下我们总结下ecmall常见数据库操作。

    1:查询操作      

    $item_info  = $model_cart->get("spec_id={$spec_id} and goods_id=‘".$spec_info[‘goods_id‘]."‘ AND session_id=‘" . SESS_ID . "‘");

    2:删除操作

    $droped_rows = $model_cart->drop(‘rec_id=‘ . $rec_id . ‘ AND session_id=\‘‘ . SESS_ID . ‘\‘‘, ‘store_id‘);

    3:修改操作

    $model_cart->edit($where, array(
            ‘quantity‘  =>  $quantity,
        ));

   $model_goodsstatistics->edit($spec_info[‘goods_id‘], ‘carts=carts+1‘);

   4:连表查询,left join

   $cart_items = $cart_model->find(array(
            ‘conditions‘    => ‘session_id = \‘‘ . SESS_ID . "‘" . $where_store_id . $where_user_id,
            ‘fields‘        => ‘this.*,store.store_name‘,
            ‘join‘          => ‘belongs_to_store‘,
        ));

    5:ecmall的原始数据库写法

     $member_model = & m(‘member‘);
     $res = $member_model->getRow("select * from ".DB_PREFIX."member where user_id=‘1‘");

    6:按简单条件检索数据库find()方法。

        $addresses     = $model_address->find(array(
            ‘conditions‘    => ‘user_id = ‘ . $this->visitor->get(‘user_id‘),
        ));

ecmall数据库基本操作,布布扣,bubuko.com

ecmall数据库基本操作

原文:http://www.cnblogs.com/yelp/p/3605706.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!