Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.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 如何在CodeIgniter 3中对产品进行分类?_Php_Sorting_Web_Codeigniter 3_Backend - Fatal编程技术网

Php 如何在CodeIgniter 3中对产品进行分类?

Php 如何在CodeIgniter 3中对产品进行分类?,php,sorting,web,codeigniter-3,backend,Php,Sorting,Web,Codeigniter 3,Backend,我正在创建一个小的电子商店来销售它的产品,但我不知道我需要如何分类。所以我需要根据品牌、价格范围、性别(男性或女性)对商品进行分类。若用户提供了所有三个细节,我只需在3 where语句中执行,如下所示: $this->db->where('brands', $brand_name); $this->db->where('price', $price); $this->db->where('gender', $gen); 但若用户只给我两个类别,那个么空语句会

我正在创建一个小的电子商店来销售它的产品,但我不知道我需要如何分类。所以我需要根据品牌、价格范围、性别(男性或女性)对商品进行分类。若用户提供了所有三个细节,我只需在3 where语句中执行,如下所示:

$this->db->where('brands', $brand_name);
$this->db->where('price', $price);
$this->db->where('gender', $gen);
但若用户只给我两个类别,那个么空语句会在哪里产生问题呢?若用户给了我多个品牌名称,我如何编写多个where语句进行排序


谢谢

无论
$brand\u name
是否包含字符串或 排列


无论
$brand\u name
是否包含字符串或 排列


请自己努力解决问题,或在提问前试着看例子。请自己努力解决问题,或在提问前试着看例子。
$this->db->where_in('brands', (array) $brand_name);