Troppe modifiche non ce la faccio
This commit is contained in:
35
index.php
35
index.php
@@ -34,29 +34,34 @@ $result = mysqli_query($conn, $sql);
|
||||
<body>
|
||||
<?php
|
||||
if($result){
|
||||
if(isset($_GET["customerId"])){
|
||||
# Tabella Prodotti
|
||||
echo "<h2>Ordini del cliente " . $customer_id . "</h2>";
|
||||
if((isset($_GET["customerId"]) || isset($_GET["orderId"])) && mysqli_num_rows($result) > 0) {
|
||||
echo "<form method='GET' action='index.php'>";
|
||||
echo "<select id='orderId' name='orderId'>";
|
||||
while($row = mysqli_fetch_assoc($result)) {
|
||||
echo "<option value='" . $row['OrderID'] . "'>" . $row['OrderID'] . "</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "<input type='submit' value='Visualizza Dettagli Ordine'>";
|
||||
echo "</form>";
|
||||
# Reset index della query
|
||||
mysqli_data_seek($result, 0);
|
||||
}
|
||||
if(isset($_GET["orderId"])){
|
||||
echo "<table>";
|
||||
echo "<tr>";
|
||||
if (mysqli_num_rows($result) == 0) {
|
||||
echo "<th>Il cliente ". $customer_id ." non ha ordini</th>";
|
||||
}
|
||||
else {
|
||||
echo "<th>ID Ordine</th>";
|
||||
}
|
||||
echo "<th>ID Prodotto</th><th>Nome Prodotto</th><th>Quantità per unità</th><th>Prezzo</th><th>Quantità ordinata</th>";
|
||||
echo "</tr>";
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
echo "<tr>";
|
||||
echo "<td><a href='index.php?orderId=" . $row['OrderID'] ."'>" . $row['OrderID'] ."</a></td>" ;
|
||||
echo "<td>" . $row['ProductID'] . "</td>" ;
|
||||
echo "<td>" . $row['ProductName'] . "</td>" ;
|
||||
echo "<td>" . $row['Unit'] . "</td>";
|
||||
echo "<td>" . $row['Price'] . "$</td>" ;
|
||||
echo "<td>" . $row['order_quantity'] . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
else if(isset($_GET["orderId"])){
|
||||
echo "WIP";
|
||||
}
|
||||
else {
|
||||
if(!isset($_GET["customerId"]) && !isset($_GET["orderId"])){
|
||||
echo "<form method='GET' action='index.php'>";
|
||||
echo "<select id='customerId' name='customerId'>";
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
|
||||
Reference in New Issue
Block a user