Spostamento tag tabella per migliore leggibilità pagina + script PHP

This commit is contained in:
2026-02-18 11:44:45 +01:00
parent ed282399fd
commit 65a88933f7

View File

@@ -28,27 +28,34 @@ $id = $_GET["Selezione"]
<input type=submit value="Cerca">
</form>
<br>
<?php
if ($result){
$queryProdotti = "SELECT ProductID, ProductName, CategoryID, Unit, Price FROM Products";
$result = mysqli_query($conn, $queryProdotti);
echo "<table><tr><th>ID</th><th>Name</th><th>Unit</th><th>Price</th></tr>";
while($row = mysqli_fetch_assoc($result)){
if($row["CategoryID"] == $id){
echo "<tr>";
echo "<td>" . $row["ProductID"] . "</td>";
echo "<td>" . $row["ProductName"] . "</td>";
echo "<td>" . $row["Unit"] . "</td>";
echo "<td>" . $row["Price"] . "</td>";
echo "</tr>";
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Unit</th>
<th>Price</th>
</tr>
<?php
if ($result){
$queryProdotti = "SELECT ProductID, ProductName, CategoryID, Unit, Price FROM Products";
$result = mysqli_query($conn, $queryProdotti);
echo "";
while($row = mysqli_fetch_assoc($result)){
if($row["CategoryID"] == $id){
echo "<tr>";
echo "<td>" . $row["ProductID"] . "</td>";
echo "<td>" . $row["ProductName"] . "</td>";
echo "<td>" . $row["Unit"] . "</td>";
echo "<td>" . $row["Price"] . "</td>";
echo "</tr>";
}
}
}
echo "</table>";
}
else{
echo "Errore nella query: " . mysqli_error($conn);
}
?>
else{
echo "Errore nella query: " . mysqli_error($conn);
}
?>
</table>
</body>
</html>