1.插入单条数据
$data[0]['cardid'] = $_POST['cardid'];
$data[0]['name'] = $_POST['name']; $data[0]['mobile'] = $_POST['mobile']; $data[0]['email'] = $_POST['email']; $data[0]['address'] = $_POST['address']; $data[0]['proid']= $_POST['proid'];M('khmember')->addAll($data);
或者
$data[0]['cardid'] = $_POST['cardid'];$data[0]['name'] = $_POST['name'];$data[0]['mobile'] = $_POST['mobile'];$data[0]['email'] = $_POST['email'];$data[0]['address'] = $_POST['address'];$data[0]['proid']= $_POST['proid']; $r = M('khmember')->addAll($data);if(false!==$r){ $this->success(L('成功')); //$this->display(); }else{ $this->error(L('失败')); }
2.插入多条数据
//方法一 $data[0]['pass'] ='eee';$data[1]['pass'] ='fff'; M('kahao')->addAll($data);
//方法二
foreach($list as $key=> $node){
$data[$key]['role_id']=$rid; $data[$key]['node_id']=$node['id']; $data[$key]["level"]=$node['level']; $data[$key]["pid"]=$node['pid']; }M('kahao')->addAll($data);
3.查询数据
$list=M('Node')->where('id in('.$node_id.')')->select();
4.删除数据
$re=M('user')->where('role_id = '.$rid)->delete();
5.where
$where = array('id'=>'1'); $M('member')->where($where)->select();
6.更新save
$date['mobile'] = $_POST['mobile'];$where = array('id'=>'1'); M('member')->where($where)->save($date);