search

Home  >  Q&A  >  body text

If thinkphp uses a certain string to query all records in the data table whose fields contain this string

public function Search_clients($client_str)

{
    
     $sql = 'SELECT * WHERE FIND_IN_SET($client_str,desc)';
     $condition = $this->query($sql);
    
}


写的sql语句不对   
desc是数据表的字段名
$client_str是字段值    

Beginner to learn PHP, please help me solve my doubts

滿天的星座滿天的星座2757 days ago473

reply all(1)I'll reply

  • 阿神

    阿神2017-05-18 10:47:54

    Where is your watch name? . Also, you have to look at the tp manual for the query method.
    For example:
    $User = M("User"); // Instantiate the User object
    $User->where('type=1 AND status=1')->select();

    reply
    0
  • Cancelreply