Spostamento tag tabella per migliore leggibilità pagina + script PHP
This commit is contained in:
11
index.php
11
index.php
@@ -29,11 +29,18 @@ $id = $_GET["Selezione"]
|
|||||||
</form>
|
</form>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Unit</th>
|
||||||
|
<th>Price</th>
|
||||||
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
if ($result){
|
if ($result){
|
||||||
$queryProdotti = "SELECT ProductID, ProductName, CategoryID, Unit, Price FROM Products";
|
$queryProdotti = "SELECT ProductID, ProductName, CategoryID, Unit, Price FROM Products";
|
||||||
$result = mysqli_query($conn, $queryProdotti);
|
$result = mysqli_query($conn, $queryProdotti);
|
||||||
echo "<table><tr><th>ID</th><th>Name</th><th>Unit</th><th>Price</th></tr>";
|
echo "";
|
||||||
while($row = mysqli_fetch_assoc($result)){
|
while($row = mysqli_fetch_assoc($result)){
|
||||||
if($row["CategoryID"] == $id){
|
if($row["CategoryID"] == $id){
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
@@ -44,11 +51,11 @@ $id = $_GET["Selezione"]
|
|||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "</table>";
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo "Errore nella query: " . mysqli_error($conn);
|
echo "Errore nella query: " . mysqli_error($conn);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user