我想要建立一个算法来搜索和过滤我的数据库中的数据。我的页面上有三个下拉列表:
MySQL数据库表有字段:
id, title, description, category, product, brand我的目标是根据从下拉列表中选择的项目进行搜索。做这件事最好的方法是什么?我应该将表单结果发送到一个函数中,在那里计算它并发送到视图中吗?
你能告诉我连接这三个参数的方法吗?
我正在用CodeIgniter编写它的PHP代码。
发布于 2012-07-23 08:22:19
这是通用的方法。
WHERE
(description=@description_parameter or @description_parameter is null) and
(category=@category_parameter or @category_parameter is null) and
(product=@product_parameter or @product_parameter is null) and
(brand=@brand_parameter or @brand_parameter is null) https://stackoverflow.com/questions/11608608
复制相似问题