Home  >  Article  >  Backend Development  >  多条件查询,提交的空值(条件)怎么办

多条件查询,提交的空值(条件)怎么办

WBOY
WBOYOriginal
2016-06-13 12:34:21907browse

多条件查询,提交的空值(条件)怎么处理
表1里有品牌,年限,车型
board(BMW,ford,aodi)
year(2011,2012,2013)
type(car,suv,mpv)

我做了三个下拉菜单,用户搭配选择查询
1,选了board里的BMW和year里的2013,但第三个type没选,

但在做的时候type字段就会发送空,查询时就等于
board='BMW'AND year="2013" AND type='' 
我要实现 不选择的字段IS NOT NULL就是BMW和2013的所有车型,
board='BMW'AND year="2013" AND type is not null

或者

board='BMW'AND year="2013"
这个怎么做,

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn