我需要对该表进行排序以显示使用文本框设置的 2 个值之间的价格,但我尝试了很多验证,但它在这里不起作用是文本框的形式和我认为查询应该是什么(来自 index2.php ):
<form action ="index2.php" method="post">
Games priced<input action="index2.php" method="post" type="text" name="min">
Between<input action="index2.php" method="post" type="text" name="max">
<input type="submit" value="Sort">
<?php
$query = "SELECT * FROM CSGames WHERE price <=min AND >=max ";
$result = pg_query("SELECT * FROM CSGames WHERE price <=min AND >=max ");
?>
这是我正在使用的 sql 数据库
<?php
$con = pg_connect("bla bla");
if (!$con)
{
die('Could not connect: ' . pg_error());
}
$result = pg_query("SELECT * FROM CSGames");
echo "<table>
<tr>
<th>Title</th>
<th>Platform</th>
<th>Description</th>
<th>Price</th>
<th>Select</th>
</tr>";
while($row = pg_fetch_array($result)){
echo"<tr>";
echo "<td>" . $row['1'] . "</td>";
echo "<td>" . $row['2'] . "</td>";
echo "<td>" . $row['3'] . "</td>";
echo "<td>" . $row['4'] . "</td>";
echo '<td><input type="checkbox" name="games[]" value="' . $row['1'] . '|||' . $row['2'] . '|||'. $row['3'] . '|||' . $row['4'] . '"/></td>';
echo"</tr>";
}
echo"</table>";
pg_close($con);
?>
我认为这只是错误的查询,但我不确定它是否有帮助这是我正在处理的页面 http://users.aber.ac.uk/edd14/cs25010/index.php