-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualizzaViaggi.php
78 lines (75 loc) · 1.65 KB
/
visualizzaViaggi.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CarPooling</title>
<link href="css/baseStyle.css" type="text/css" rel="stylesheet">
</head>
<body>
<?php
include "include/mainMenu.php";
include "include/databaseConnection.php";
include "include/utilyFunction.php";
?>
<h1>Visualizza viaggi disponibili</h1>
<?php
$q="SELECT * FROM viaggi";
$result=$mysqli->query($q);
echo "<table>";
while($row=$result->fetch_row()){
echoTableRow($row);
}
echo "</table>";
?>
<h2>Metodo alternativo</h2>
<?php
$q="SELECT * FROM viaggi";
$result=$mysqli->query($q);
echo "<table>";
while($row=$result->fetch_row()){
echo "<tr>";
for ($i=0;$i<9;$i++){
if($i==7){
$q2="SELECT nome FROM autisti WHERE idAutista=".$row[$i];
$row2=$mysqli->query($q2)->fetch_row();
echo "<td>";
echo $row2[0];
echo "</td>";
}
else{
echo "<td>";
echo $row[$i];
echo "</td>";
}
}
echo "</tr>";
}
echo "</table>";
?>
<h2>Metodo alternativo2</h2>
<?php
$q="SELECT * FROM viaggi";
$result=$mysqli->query($q);
echo "<table>";
while($row=$result->fetch_row()){
echo "<tr>";
for ($i=0;$i<9;$i++){
if($i==7){
$q2="SELECT CONCAT(nome,' ',cognome) FROM autisti WHERE idAutista=".$row[$i];
$row2=$mysqli->query($q2)->fetch_row();
echo "<td>";
echo $row2[0];
echo "</td>";
}
else{
echo "<td>";
echo $row[$i];
echo "</td>";
}
}
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>