Compare commits

..

5 Commits

2 changed files with 12 additions and 14 deletions

View File

@@ -40,7 +40,6 @@ fclose($file);
echo "<tr><td>" . $utenti[$i]->id . "</td><td><a href=\"ordini.php?id=" . $utenti[$i]->id ."\">" . $utenti[$i]->name . "</a></td><td><a href=\"mailto:" . $utenti[$i]->email ."\">" . $utenti[$i]->email . "</a></tr>"; echo "<tr><td>" . $utenti[$i]->id . "</td><td><a href=\"ordini.php?id=" . $utenti[$i]->id ."\">" . $utenti[$i]->name . "</a></td><td><a href=\"mailto:" . $utenti[$i]->email ."\">" . $utenti[$i]->email . "</a></tr>";
} }
?> ?>
</table> </table>
</body> </body>
</html> </html>

View File

@@ -18,7 +18,7 @@ fgets($file);
while (($linea = fgets($file)) !== false) { while (($linea = fgets($file)) !== false) {
$campi = explode(",", $linea); $campi = explode(",", $linea);
if($campi[1] == $requestedId){ if($campi[1] == $requestedId){
array_push($ordini, new User($campi[0], $campi[2], $campi[3])); array_push($ordini, new User($campi[0], $campi[2], floatval($campi[3])));
} }
} }
fclose($file); fclose($file);
@@ -31,19 +31,18 @@ fclose($file);
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
</head> </head>
<body> <body>
<p><a href="index.php">Torna alla lista</a></p>
<table> <?php
<tr> if(count($ordini) == 0){
<th>ID Ordine</th> echo "<p>Nessun ordine associato all'utente</p>";
<th>Prodotto</th> }
<th>Importo</th> else{
</tr> echo "<table><tr><th>ID Ordine</th><th>Prodotto</th><th>Importo</th></tr>";
<?php
for($i=0; $i<count($ordini); $i++){ for($i=0; $i<count($ordini); $i++){
echo "<tr><td>" . $ordini[$i]->id . "</td><td>" . $ordini[$i]->product . "</td><td>" . $ordini[$i]->importo . "</td></tr>"; echo "<tr><td>" . $ordini[$i]->id . "</td><td>" . $ordini[$i]->product . "</td><td>" . number_format($ordini[$i]->importo,2,",",".") . "</td></tr>";
} }
?> echo "</table>";
}
</table> ?>
</body> </body>
</html> </html>