Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 多数据搜索功能_Php_Pdo - Fatal编程技术网

Php 多数据搜索功能

Php 多数据搜索功能,php,pdo,Php,Pdo,我目前正在开发一个搜索功能,但我觉得应该有一个比我现有的更好的方法 $this->pdo->select()->from('orders') ->where('orderid', 'LIKE', '%'.$id.'%', 'OR') ->where('date', 'LIKE', '%'.$date.'%', 'OR') ->where('PRICE', 'LIKE', '%'.$PRICE.'%'); 另外,如果用户在其中一个字段中

我目前正在开发一个搜索功能,但我觉得应该有一个比我现有的更好的方法

$this->pdo->select()->from('orders')
    ->where('orderid', 'LIKE', '%'.$id.'%', 'OR')
    ->where('date', 'LIKE', '%'.$date.'%', 'OR')
    ->where('PRICE', 'LIKE', '%'.$PRICE.'%');
另外,如果用户在其中一个字段中添加数据或向所有字段中添加数据,会怎么样?我想跳过每种方式的if语句


你真正的问题是什么?既然Github上有一个库,为什么不在那里创建一个问题呢?你使用的slim标记不是用于那个PDO类。@Script47所以基本上,我不想限制用户只使用1个或所有字段,但仍然有1个函数来做任何事情