dongmeijian1716 2013-04-10 19:20
浏览 40
已采纳

mysql搜索列匹配给定输入或给定输入与给定价格和价格之间的价格

I start making code my input total 7 input field 4 checkbox and 4 input text fields when i make this its work fine but look something like this search data in mysql where match input 1 or input 2 match between variable1 and variable2 where size between size1 and size2

   $fetch=mysql_query("select * from diamonds where diamond-color='".$red."' or diamond-color_pink='".$pink."'  and diamond_price between '".$min_price."' and '".$max_price."'");
  • 写回答

1条回答 默认 最新

  • douti8321 2013-04-10 19:23
    关注

    Try this:

    select * from diamonds 
     where diamond_price between 1000 and 10000
       and (diamond-color ='red' or diamond-color_pink='pink')
    

    Replace with variables where corresponding.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?