public function show(){
echo "访问了index模块下的show方法!!";
echo "欢迎你".$_GET['name'].'你的年龄是'.$_GET['age'];
$m=M('user');
$id=$_GET['id'];
$arr=$m->where("id=$id")->getField('username');
//var_dump($arr);
$this->assign('data',$arr);
$this->display();
}
public function show(){
echo "访问了index模块下的show方法!!";
echo "欢迎你".$_GET['name'].'你的年龄是'.$_GET['age'];
$m=M('user');
$id=$_GET['id'];
//$arr=$m->where("id=$id")->getField('username');
$arr=$m->where("id=$id")->find();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
}
public function show(){
echo "访问了index模块下的show方法!!";
echo "欢迎你".$_GET['name'].'你的年龄是'.$_GET['age'];
$m=M('user');
$id=$_GET['id'];
//$arr=$m->where("id=$id")->getField('username');
$arr=$m->where("id=$id")->select();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
}
public function show(){
echo "访问了index模块下的show方法!!";
echo "欢迎你".$_GET['name'].'你的年龄是'.$_GET['age'];
$m=M('user');
$id=$_GET['id'];
//$arr=$m->where("id=$id")->getField('username');
$arr=$m->where("sex=1 and username='gege'")->select();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
}
//select
public function show(){
echo "访问了index模块下的show方法!!";
echo "欢迎你".$_GET['name'].'你的年龄是'.$_GET['age'];
$m=M('user');
$username=$_GET['username'];
//$arr=$m->where("id=$id")->getField('username');
$arr=$m->where("sex=1 and username='$username'")->find();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
}
//select 2
public function show(){
echo "访问了index模块下的show方法!!";
echo "欢迎你".$_GET['name'].'你的年龄是'.$_GET['age'];
$m=M('user');
$username=$_GET['username'];
$sex=$_GET['sex'];
//$arr=$m->where("id=$id")->getField('username');
//$arr=$m->where("sex=$sex and username='$username'")->find();
$data['sex']=$sex;
$data['username']="$username";
$arr=$m->where($data)->find();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
}
//select or
public function show(){
echo "访问了index模块下的show方法!!";
echo "欢迎你".$_GET['name'].'你的年龄是'.$_GET['age'];
$m=M('user');
$username=$_GET['username'];
$sex=$_GET['sex'];
//$arr=$m->where("id=$id")->getField('username');
//$arr=$m->where("sex=$sex and username='$username'")->find();
//默认条件是and
$data['sex']=$sex;
$data['username']="$username";
$data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
}
//select id>6的
public function show(){
echo "访问了index模块下的show方法!!";
echo "欢迎你".$_GET['name'].'你的年龄是'.$_GET['age'];
$m=M('user');
$id=$_GET['id'];
// $username=$_GET['username'];
// $sex=$_GET['sex'];
//$arr=$m->where("id=$id")->getField('username');
//$arr=$m->where("sex=$sex and username='$username'")->find();
//默认条件是and
$data['id']=array('GT',6);
// $data['sex']=$sex;
// $data['username']="$username";
// $data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
}
//select <=
//默认条件是and
$data['id']=array('ELT',$id);
// $data['sex']=$sex;
// $data['username']="$username";
// $data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
//select like
//默认条件是and
$data['username']=array('like',"%$username");
// $data['sex']=$sex;
// $data['username']="$username";
// $data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
//select not like
$data['username']=array('notlike',"%$username");
// $data['sex']=$sex;
// $data['username']="$username";
// $data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
}
//select like or
$data['username']=array('like',array("%$username%","%2%"));
// $data['sex']=$sex;
// $data['username']="$username";
// $data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
//select like and
$data['username']=array('like',array("%$username%","%2%"),'and');
// $data['sex']=$sex;
// $data['username']="$username";
// $data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
//select between 方式
$data['id']=array('between',array($id1,$id2));
// $data['sex']=$sex;
// $data['username']="$username";
// $data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
//select not between
$data['id']=array('not between',array($id1,$id2));
// $data['sex']=$sex;
// $data['username']="$username";
// $data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
//select in
$data['id']=array('in ',array($id1,$id2));
// $data['sex']=$sex;
// $data['username']="$username";
// $data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
$this->assign('data',$arr);
$this->display();
//select not in
$data['id']=array('not in ',array($id1,$id2));
// $data['sex']=$sex;
// $data['username']="$username";
// $data['_logic']='or';
$arr=$m->where($data)->select();
var_dump($arr);
$this->assign('data',$arr);