【问题标题】:LessQL Like operatorLessQL Like 运算符
【发布时间】:2018-12-13 15:45:56
【问题描述】:

我想以这种方式编写查询:

$query = $orm->table();
              ->where('foo_id', $foo['id'])
              ->like('foo_name', '%DP') 
              ->fetch();

错误是:

PDOException: SQLSTATE[42S02]: 未找到基表或视图:1146 /var/www/webapp/app/vendor/morris/lessql/src/LessQL/Database.php:117 中不存在表“database_name.like”

【问题讨论】:

  • 你使用的是哪个框架?
  • 这段代码至少会导致语法错误。
  • Slim PHP + LessQL *ORM

标签: php mysql pdo lessql


【解决方案1】:

您可以通过where() 拨打LIKE

$query = $orm->table()
          ->where('foo_id', $foo['id'])
          ->where('foo_name LIKE ?', array('%DP')) 
          ->fetch();

【讨论】:

    猜你喜欢
    • 2020-10-26
    • 1970-01-01
    • 2017-08-22
    • 1970-01-01
    • 1970-01-01
    • 2012-07-06
    • 2016-11-03
    • 2016-11-22
    • 2014-03-13
    相关资源
    最近更新 更多