无法使用 where 条件


Failed to use where condition

我开发了一个应用程序,现在我需要在我的查询中使用where条件来整理从75000到150000的汽车范围..但它不返回任何东西..谁能帮我解决这个问题

    <?php
    if(isset($_GET['id']))
        {
            mysql_query($qry);
     }
    $result = mysql_query("SELECT * FROM cars where (price<75000 and price>150000)");
    echo "<table border='1'>
<tr>
<th>Id</th>
<th>color</th>
<th>cond</th>
<th>make</th>
<th>price</th>
</tr>";
while($row = mysql_fetch_array($result)) {
  echo "<tr>";?>
   <td width=5%>
                <?php echo $row['id']; ?>
            </td>
  <td width=10%>
                <?php echo $row['color']; ?>
            </td>
  <td width=10%>
                <?php echo $row['cond']; ?>
            </td>
  <td width=10%>
                <?php echo $row['make']; ?>
            </td>
  <td width=10%>
                <?php echo $row['price']; ?>
            </td>
  <?php
  echo "</tr>";
}

你的条件是错误的

SELECT * FROM cars 
where price > 75000 and price < 150000
            ^-----------------^--------------------here

您也可以使用

SELECT * FROM cars 
where price between 75000 and 150000

但这包括75000150000

如我所见,我认为您的 WHERE 子句是错误的。 WHERE (price<75000 and price>150000) ,我认为应该是: WHERE (price > 75000 AND price < 150000),你也可以使用介于子句之间。