thinkphp Screening Problems

Source: Internet
Author: User
How to make a double-sun selection based on these 2 fields ~ ~


Reply to discussion (solution)

Make a sofa static wait master elder brother's answer ~ ~

$Model->where ($condition)->select ();
$condition write the same as usual SQL, you can write multiple conditions and connections

TP has its own encapsulated functions to operate, you can also use SQL statements to operate, to see your needs, if it is very complex to write their own SQL run, if not the TP encapsulated those functions are completely enough. But like LZ this is only two conditions for query, the use of the upstairs method is completely enough.

M (' tablename ')->where ("Position = ' xxx ' and recruitment = ' xxx '")->select ();

$Model->where ($condition)->select ();
$condition write the same as usual SQL, you can write multiple conditions and connections




I'm sorry, but I can't write it all at all???? Novice ~ ~

TP has its own encapsulated functions to operate, you can also use SQL statements to operate, to see your needs, if it is very complex to write their own SQL run, if not the TP encapsulated those functions are completely enough. But like LZ this is only two conditions for query, the use of the upstairs method is completely enough.



I'm sorry, but I can't write it all at all???? Novice ~ ~

TP has its own encapsulated functions to operate, you can also use SQL statements to operate, to see your needs, if it is very complex to write their own SQL run, if not the TP encapsulated those functions are completely enough. But like LZ this is only two conditions for query, the use of the upstairs method is completely enough.



I'm sorry, but I can't write it all at all???? Novice ~ ~


$Model->where ($condition)->select ();
$condition write the same as usual SQL, you can write multiple conditions and connections




I'm sorry, but I can't write it all at all???? Novice ~ ~


$Model =m ("tablename");//replace tablename with your table name $list= $Model->where ("Position = ' xxx ' and recruitment = ' xxx ') Select (); Here, like the usual writing SQL, the XXX content for your two fields of the conditions required $this->assign ("list", $list);//finally the query array results, passed in the template, in the template loop call on the line



$Model->where ($condition)->select ();
$condition write the same as usual SQL, you can write multiple conditions and connections




I'm sorry, but I can't write it all at all???? Novice ~ ~


$Model =m ("tablename");//replace tablename with your table name $list= $Model->where ("Position = ' xxx ' and recruitment = ' xxx ') Select (); Here, like the usual writing SQL, the XXX content for your two fields of the conditions required $this->assign ("list", $list);//finally the query array results, passed in the template, in the template loop call on the line



I just don't know how that xxx is worth.
Is it the first filter or the other one?




$Model->where ($condition)->select ();
$condition write the same as usual SQL, you can write multiple conditions and connections




I'm sorry, but I can't write it all at all???? Novice ~ ~


$Model =m ("tablename");//replace tablename with your table name $list= $Model->where ("Position = ' xxx ' and recruitment = ' xxx ') Select (); Here, like the usual writing SQL, the XXX content for your two fields of the conditions required $this->assign ("list", $list);//finally the query array results, passed in the template, in the template loop call on the line



I just don't know how that xxx is worth.
Is it the first filter or the other one?




Public Function Shaixuan () {
$data =m (' Zhaopin ');
$aid =$_get[' id '];
$lists = $Data->where ("Position = ' $aid ' and recruitment = ' $aid '")->select ();
$this->assign (' lists ', $lists);
$this->display (' index ');
}




$Model->where ($condition)->select ();
$condition write the same as usual SQL, you can write multiple conditions and connections




I'm sorry, but I can't write it all at all???? Novice ~ ~


$Model =m ("tablename");//replace tablename with your table name $list= $Model->where ("Position = ' xxx ' and recruitment = ' xxx ') Select (); Here, like the usual writing SQL, the XXX content for your two fields of the conditions required $this->assign ("list", $list);//finally the query array results, passed in the template, in the template loop call on the line



I just don't know how that xxx is worth.
Is it the first filter or the other one?


Public Function  Shaixuan () {$data =m (' Zhaopin '); $aid =$_get[' id '); $lists = $Data->where ("Position = ' $aid ' and Recruitment = ' $aid ')->select (), $this->assign (' lists ', $lists); $this->display (' Index ');}
 
  
   
  {$vo [' Position ']}
 
  

Khan, this XXX does not stipulate how to preach ah, this is the condition, the condition is that you want to restrict to get the result that you want through it, then I ask you, why do you need these two fields to filter together, why not all the field is filtered! Similarly, for example, you want to filter Position is 111 of the record, that is $data->where ("Position = ' 111 '")->select (); As for this 111 if it's a dynamic, like you wrote it, get it, assemble it into SQL.

You see your project if you are directly m or D function what the data is passed directly from the page (including Get, post, and some biographies parameters), and then populated into where, if you are based on the table to create a separate model class then you need to add parameters in the public method to pass in, as follows:

/**     * @todo get ONE News info     *    /Public Function Getonenewsinfo ($id) {        $where = ' id ' = \ '. $id. ' \'';        return $this->where ($where)->select ();    }

Otherwise, it is called directly on the page:
$model = M (' table '); $where = ' id ' = \ '. $id. ' \'';        $model->where ($where)->select ();

You see your project if you are directly m or D function what the data is passed directly from the page (including Get, post, and some biographies parameters), and then populated into where, if you are based on the table to create a separate model class then you need to add parameters in the public method to pass in, as follows:

/**     * @todo get ONE News info     *    /Public Function Getonenewsinfo ($id) {        $where = ' id ' = \ '. $id. ' \'';        return $this->where ($where)->select ();    }

Otherwise, it is called directly on the page:
$model = M (' table '); $where = ' id ' = \ '. $id. ' \'';        $model->where ($where)->select ();






Yes, yes, it does. The problem is that the following content does not change

Public Function Index () {$Data = M (' Zhaopin ');//Instantiate Data data Object import (' ORG. Util.page ');//Import Paging class $count= $Data->where ($map)->count ();//query satisfies the required total number of records $page= new Page ($count, 20);//Instantiate paging class Number of incoming total records $nowpage = Isset ($_get[' P '))? $_get[' P ']:1; $adi =$_get[' id '); $list = $Data->where ($map, "Position = ' $aid ' and Recruitment = ' $aid ')->order (' Shijian desc,id asc ')->page ($nowPage. ', '. $Page->listrows)->select (); $ Show = $Page->show ();//page display output $this->assign (' page ', $show);//Assignment Paging output $this->assign (' list ', $list);//Assignment Data set $ This->display (); Output template}-------------------------------------------------- Here is the filter-------------------------------------------------------------------------------------------------all
 
  
   {$vo [' Position ']}
  
  
 
 
Regional:
all Shenzhen {$vo [' recruitment ']}
-----------------------------------------------------Below is the content--------- ----------------------------------------------------------------------------
{$vo [' Job ']|mb_substr=0,8, ' UTF-8 '} {$vo [' company_name ']} {$vo [' recruitment ']} {$vo [' Shijian ']}
Number of recruits: {$vo [' hiring '} The nature of the company: {$vo [' Nature ']} size: {$vo [' company_scale '} person experience: {$vo [' work_experience '} Years of education: {$vo [' degree _required ']} Post salary: {$vo [' salary '} yuan/month
Job Requirements: {$vo [' job_requirements ']|mb_substr=0,150, ' UTF-8 '} View jobs

Khan, this XXX does not stipulate how to preach ah, this is the condition, the condition is that you want to restrict to get the result that you want through it, then I ask you, why do you need these two fields to filter together, why not all the field is filtered! Similarly, for example, you want to filter Position is 111 of the record, that is $data->where ("Position = ' 111 '")->select (); As for this 111 if it's a dynamic, like you wrote it, get it, assemble it into SQL.



Yes, yes, it does. The problem is that the following content does not change

Public Function Index () {$Data = M (' Zhaopin ');//Instantiate Data data Object import (' ORG. Util.page '),//import paging class $count = $Data->where ($map)->count ();//query satisfies the required total number of records $Page = new Page ($count            , 20);//Instantiate the total number of incoming records in the paging class $nowPage = Isset ($_get[' P '])? $_get[' P ']:1;            $adi =$_get[' id ']; $list = $Data->where ($map, "Position = ' $aid ' and recruitment = ' $aid '")->order (' Shijian desc,id asc ')->page ($            Nowpage. ', '. $Page->listrows)->select (); $show = $Page->show ();//pagination Display output $this->assign (' page ', $show);//Assignment Paging output $this->assign (' list ', $list);//Assignment Data Set $this->display (); Output template}-------------------------------------------------- Here is the filter-------------------------------------------------------------------------------------------------all
 
  
   {$vo [' Position ']}
  
  
 
 
zone:
all Shenzhen {$vo [' recruitment ']}
-----------------------------------------------------Below is the content--------------------------------------- ----------------------------------------------
{$vo [' Job ']|mb_substr=0,8, ' UTF-8 '} {$vo [' Company_Name ']} {$vo [' Recruitment ']} {$vo [' Shijian ']}
number of recruits: {$vo [' hiring '} company nature: {$vo [' Nature ']} scale: {$vo [' company_scale '} person experience: {$vo [' work_experience ']} years Education: {$vo [' degree_required ']} Job Salary: {$vo [' salary '} yuan/month
Post requirements: {$vo [' job_requirements ']|mb_substr=0,150 , ' UTF-8 '} view position
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.