任何帮助将不胜感激。我的错误是:
查询问题:“ where子句”中的未知列“ hi”
我试图确保用户输入的是数字。
我尝试通过is_numeric()
对其进行验证,但是它不起作用。
<?php
require_once("conn.php");
$quantity = $_POST['quantity'];
$sql = "SELECT * FROM product WHERE quantityInStock >= $quantity";
$results = $dbConn->query($sql) or die ('Problem with query: ' . $dbConn->error); ?>
<?php
if (is_numeric($quantity)){
if ($quantity >= 60) {
echo "<p>There are no products that have more than 60 in stock.</p>";
} else {
echo "
<h1>Products with stock > $quantity</h1>
<table>
<tr>
<th>Name </th>
<th>Quantity In Stock</th>
<th>Price</th>
</tr>";
}
} else {
echo "<p>The value entered for the quantity was not a number.</p>";
} ?>
我认为这可能是我的sql代码的一部分。我正在尝试查询:
$sql = "SELECT * FROM product WHERE quantityInStock >= $quantity"; ```