zoukankan      html  css  js  c++  java
  • 微擎语法实例

    $condition = ' and uniacid = :uniacid and deleted=0';
    $params = array(':uniacid' => $_W['uniacid']);

    $pindex = max(1, intval($_GPC['page']));
    $psize = 20;

    //查询表中的所有数据
    $list = pdo_fetchall("SELECT * FROM " . tablename('ewei_shop_perm_role'). ('WHERE 1 '.$condition. 'ORDER BY id desc LIMIT').($pindex - 1)* $psize ',' .$psize .$params);
    //统计每个角色下面有几个人
    foreach ($list as &$row)
    {
    $row['usercount'] = pdo_fetchcolum('select count(*) from '. tablename('ewei_shop_perm_user') . 'where roleid=:roleid limit 1',array(':roleid' =>$row['id']));
    }
    //统计角色表里共有多少个角色
    $total = pdo_fetchcolumn('SELECT count(*) FROM ' . tablename('ewei_shop_perm_role') . ('  WHERE 1 ' . $condition . ' '), $params);
    //更新语句
    $data = array('uniacid' => $_W['uniacid'],'rolename' =>trim($_GPC['rolename']),'status' =>intval($_GPC['status']),'perms2' =>trim($_GPC['permsarray']));
    pdo_update('ewei_shop_perm_role',$data,array('id' =>$id,'uniacid' =>$_W['uniacid']));
    //插入语句
    pdo_insert('ewei_shop_perm_role',$data);
    //展示模板
    include $this->template();
    include $this->template('role.html');
    //删除语句
    $items = pdo_fetchall('SELECT id,rolename FROM ' . tablename('ewei_shop_perm_role') . ('WHERE id in ('. $id .' ) AND uniacid=') .$_W['uniacid'])

    foreach ($items as $item) {
    pdo_delete('ewei_shop_perm_role',array('id' => $item['id']));
    plog('perm.role.delete','删除角色 ID:' .$item['id'] . '角色名称: ' .$item['rolename'] . '');
    }




    世界上最美的风景,是自己努力的模样
  • 相关阅读:
    类的内部成员之五-----内部类
    接口的使用
    java中abstract关键字的使用
    Redis主从复制原理——哨兵模式(Sentinel)
    Redis主从复制原理——薪火相传
    Redis主从复制原理——一主二仆
    Git---使用Github实现团队内协作操作步骤
    Final知识点总结
    代码块知识点总结
    Linux学习计划
  • 原文地址:https://www.cnblogs.com/xiong-hua/p/11736992.html
Copyright © 2011-2022 走看看