同一个表统一界面修改不同字段的值 关闭 开启

//方法 

if(!empty($_GET['action']) and $_GET['action'] == 'configs')

 //同一个表统一界面修改不同字段的值,用op区分
 if(!empty($_GET['op'])){
  
  $data = array($_GET['op'] => intval($_GET['id']));
  $db->update('ew_username_components',$data,"uid=".$_SESSION['business']['uid']);
 }
 if(!empty($_GET['del']) and $_GET['del'] == 'del' and intval($_GET['id']) > 0){
 
  $db->delete('ew_username_components_self', 'id = '.intval($_GET['id']));

 }


 $view->values = $db->fetchRow("SELECT * FROM ew_username_components WHERE uid='". $_SESSION['business']['uid']."'");
 $view->self = $db->fetchAll("SELECT * FROM ew_username_components_self WHERE business_id='". $_SESSION['business']['uid']."'");
 echo $view->render('business/components/configs.php');
}

//界面

<script>
function del(){
 if(confirm('确定更改状态么?'))
  return true;
 else
  return false;
}
</script>

<tr>
  <td class="item_title">每天签到</td>
  <td class="item_input">&nbsp;
       
            <?php if($this->values['c1']==0){?><a href="components.php?action=configs&op=c1&id=1"  onClick="return del()">已启用 点击关闭</a><?php }?>
                   
            <?php if($this->values['c1']==1){?><a href="components.php?action=configs&op=c1&id=0" onClick="return del()">已关闭 点击开启</a><?php }?>

 <a href="components.php?action=sign">编辑查看</a></td>
 </tr>
    <tr>
      <td class="item_title">邀请有奖</td>
      <td class="item_input">&nbsp;<?php if($this->values['c2']==0){?><a href="components.php?action=configs&op=c2&id=1"  onClick="return del()">已启用 点击关闭</a><?php }?>
                   
     <?php if($this->values['c2']==1){?><a href="components.php?action=configs&op=c2&id=0" onClick="return del()">已关闭 点击开启</a><?php }?> <a href="components.php?action=invited">编辑查看</a></td>
    </tr>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值