php - LessQL Like 运算符

标签 php mysql pdo lessql

我想这样编写查询:

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

错误是:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database_name.like' doesn't exist in /var/www/webapp/app/vendor/morris/lessql/src/LessQL/Database.php:117

最佳答案

您可以通过 where() 调用进行 LIKE:

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

关于php - LessQL Like 运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51186578/

相关文章:

PHP MYSQL 存储密码以供 PHP 调用

php - 在php中检查字符串的第一个和最后一个字符最简单的是什么

php - apache - 无需 root 的额外 mysql 安装

php - 从字符串中检索完整的电子邮件地址

java - 在 java swing 中构建后,我的数据库会出现在 jar 文件中吗?

python - Django:如何查询多个表中的多个字段

php - MySql 查询中的决斗 WHERE 子句

php - 像 stackoverflow 这样的网站是如何运作的?

php - 将数组绑定(bind)到 =ANY() 条件的 SQL 注入(inject)

php - 无法在 bool 类型中插入假值 - 被强制转换为空字符串