美文网首页
微擎增删改查

微擎增删改查

作者: StevenQin | 来源:发表于2019-04-24 22:37 被阅读0次

    官方文档

    https://s.w7.cc/index.php?c=wiki&do=view&id=1&list=173

    • 符合微擎命名规则的数据表
    ims_模块名_表名
    //如
    ims_health_moniter_orders
    

    增加

    int | boolean
    pdo_insert($tablename, $data = array(), $replace = false)
    
    //案例
       $arr=['name'=>'英语' ];
       $result = pdo_insert('health_moniter_category', $arr,  false);
    

    删除

    int | boolean

     pdo_delete($tablename, $condition = array(), $glue = 'AND')
    
    //例句
     $result = pdo_delete('health_moniter_category', array('id'=>3));
            var_dump($result)
    

    修改

    array | boolean

    pdo_update($tablename, $data = array(), $condition, $glue = 'AND')
    
    //例句
     $result = pdo_update('health_moniter_category', array('name'=>'web编程'), array('id'=>1));
    

    查询

    查单条

    array | boolean

    pdo_get($tablename, $condition = array(), $fields = array());
    
    //例名
    $result = pdo_get('health_moniter_course', array('id'=>1), array());
    

    查多条

    array | boolean

    pdo_getall($tablename, $condition = array(), $fields = array(), $keyfield = '',$orderby = array(), $limit = array());
    
    
    //例句
    $result = pdo_getall('health_moniter_course',  array(), array(), '',array(), array());
    //或者
    $result = pdo_getall('health_moniter_course');
    

    查多表

        $sql="SELECT cou.*,cate.*  FROM  ims_health_moniter_course as cou inner JOIN ims_health_moniter_category as cate on (cou.category = cate.id)";
        $result = pdo_fetchall($sql);
        var_dump($result);
    

    相关文章

      网友评论

          本文标题:微擎增删改查

          本文链接:https://www.haomeiwen.com/subject/ibrngqtx.html