嗨,我想知道你是否可以帮助我?我正在尝试通过使用存储在名为 items 的数组中的参考号并在表中显示行来从数据库中获取行,但我只能获取要在页面上显示的参考号.. .任何帮助真的很感激吗?
</head>
<h1>Shopping Cart</h1>
<body>
<?php $con = pg_connect("blah blah");
if (!$con){
die('Could not connect: ' . pg_error());
}
if (isset($_POST['items'])) {
$n = count($_POST['items']);
for($i=0; $i < $n; $i++)
echo $_POST['items'][$i];
}
if(!$_SESSION["selectingrows"]== 0){
$result = pg_query ($con, "SELECT title, platform, description, price FROM CSGames WHERE 'refnumber' = 'items[]'");
echo "<table>
<tr>
<th>Title</th>
<th>Platform</th>
<th>Description</th>
<th>Price</th>
</tr>";
while($rows = pg_fetch_result($result));{
echo"<tr>"; echo "<td>" . $rows['title'] . "</td>"; echo "<td>" . $rows['platform'] . "</td>"; echo "<td>" . $rows['description'] . "</td>"; echo "<td>" . $rows['price'] . "</td>";
echo"</tr>";
}
echo"</table>";
}