douji4948 2014-09-09 02:14
浏览 58
已采纳

使用来自CONCAT和LIKE子句的结果[关闭]

I just want a simple explanation on what does this CONCAT and LIKE does in this code. Thank you.

$data = $this->request->data;
    $conditions = array('authenid' => $data['id'], 'isblacklist' => $data['isblacklist']);

    if( $data['key'] == "msisdn" ) {
        if(isset ($data["search"])){
            if( trim($data["search"]) != "" ) {
                $conditions[ "CONCAT(msisdn,',',ton,',',npi) LIKE" ] = "%".trim($data["search"])."%";
            }
        }
        $tmpData = $this->blkwhtlist_msisdn->find('all', array(
            'conditions' => $conditions
        ));
  • 写回答

1条回答 默认 最新

  • doulin8374 2014-09-09 02:37
    关注

    I guess you are trying querys in mysql db:

    CONCAT is a string function to concatenate in mysql:

    CONCAT('abc', '.de') that return a string 'abc.de'
    

    And the LIKE is a mysql operator used to select data based on patterns. Therefore the LIKE operator is often used in the WHERE clause of the SELECT statement. mysql provides two wildcard characters for using with the LIKE operator, the percentage % and underscore _.

    • The percentage ( %) wildcard allows you to match any string of zero or more characters.
    • The underscore ( _) wildcard allows you to match any single character.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址