Php multi-condition superimposed query & lt ;? Header ("Content-Type: text/html; charset = utf-8"); include (".. /manage/include/function. php "); $ brand = substr ($ _ POST [" brand "], 0, strlen ($ _ POST php multi-condition superposition query
Header ("Content-Type: text/html; charset = utf-8 ");
Include ("../manage/include/function. php ");
$ Brand = substr ($ _ POST ["brand"], 0, strlen ($ _ POST ["brand"])-1 );
$ Color = substr ($ _ POST ["color"], 0, strlen ($ _ POST ["color"])-1 );
$ Caizhi = $ _ POST ["caizhi"];
$ Style = $ _ POST ["style"];
$ Kucun = $ _ POST ["kucun"];
Echo ($ brand ."
");
Echo ($ color ."
");
Echo ($ caizhi ."
");
Echo ($ style ."
");
Echo ($ kucun );
$ Q = "select * from pros_pro where (1 = 1 )";
If ($ brand! = Null ){
$ Q = $ q + "and psp_brand in (". $ brand .")";
}
If ($ color! = Null ){
$ Q = $ q + "and psp_color in (". $ color .")";
}
If ($ caizhi! = Null ){
$ Q = $ q + "and psp_caizhi = '". $ caizhi ."'";
}
If ($ style! = Null ){
$ Q = $ q + "and psp_style = '". $ style ."'";
}
If ($ kucun! = Null ){
$ Q = $ q + "order by psp_stock desc ";
} Else
{
$ Q = $ q + "order by psp_id desc ";
}
$ Rows = query ($ q );
If ($ row = mysql_fetch_array ($ rows ))
{
Do {
?>
}
Else
{?>
There is no matching information. Please Redefine the search criteria!
}
?>
What's wrong with this code? Why error: Warning: mysql_fetch_array () expects parameter 1 to be resource, boolean given in/data/home/hmu069081/htdocs/products/get_post.php on line 37
There is no matching information, but the selected condition is clearly recorded: More