zoukankan      html  css  js  c++  java
  • TP5中find_in_set的用法

    $id=4;
    Db::name('menu')->where('FIND_IN_SET(:id,pid_all)',['id' => $id])->update([$field => $title]);
     
    $map[]=['exp','FIND_IN_SET(2,needID)'];
    $db->where($map)->select();
     

    TP5.1.21   版本之后数组查询支持:

    要达到这样子查询:
    1、首先引用: use thinkdbWhere;
    2、定义数组:$where = new Where;
    3、就可以用了:$where['title'] = ['like', "%".$sotitle."%"];
    $where['class_id'] = ['in', '$cid_all'];
    $where['id'] = ['in', $all_user_id];//或这样子
    $where['title'] = ['like', '%php%'];
    $where['id'] = ['<>', $id];
    $where['id'] = ['notin', $all_user_id];//不等于
    //值为数字
    $id=419;
    $where[] = ['exp',Db::raw("FIND_IN_SET($id,category)")];//category值为数字,例子:419,415,414
    //值为字符串
    $id值等于dfd 要注意'引号
    $where[] = ['exp',Db::raw("FIND_IN_SET('$id',category)")];//category值为数字,例子:'349/417/419','349/413/415','349/413/416
  • 相关阅读:
    十二经络容易堵塞穴位
    考研英语词汇-乱序便携版-遗忘曲线
    分享一个硬核理工类科普节目:回到2049(12月17号取消置顶)
    191129
    191130
    191128
    191127
    191126
    191125
    微信公众号自定义菜单中添加图标(转)
  • 原文地址:https://www.cnblogs.com/sgj123/p/13268051.html
Copyright © 2011-2022 走看看