Spostamento tag tabella per migliore leggibilità pagina + script PHP
This commit is contained in:
47
index.php
47
index.php
@@ -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>
|
||||
Reference in New Issue
Block a user