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