-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusuario.php
104 lines (80 loc) · 2.78 KB
/
usuario.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<title>NutriFit</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="css/style.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="js/index.js"></script>
</head>
<header class="header">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">NutriFit</a>
</div>
<ul >
<li><a href="home.html">Home <span class="sr-only">(current)</span></a></li>
<li><a href="usuarios.php">Usuarios</a></li>
<li><a href="dietas.php">Dietas</a></li>
<li><a href="rutinas.php">Rutinas</a></li>
</ul>
</div>
</nav>
</header>
<body>
<?php
$dbhost = "localhost";
$dbuser = "codelink";
$dbpass = "Martinn1.";
$db = "nutrifit";
// Create connection
$conn = new mysqli($dbhost, $dbuser, $dbpass, $db);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$id = $_GET['id'];
// $id = 3;
$query = "SELECT * FROM `usuarios` where id='{$id}'";
$result = $conn->query($query);
if ($result->num_rows > 0) {
?>
<ul class="list-group">
<?php
while($row = $result->fetch_assoc()) {
?>
<li class="list-group-item"><?php echo $row['nombre']?></li><br>
<?php
}
?>
</ul>
<?php
}
$query2 = "SELECT * FROM `datos` where id_usuario='{$id}'";
$result = $conn->query($query2);
if ($result->num_rows > 0) {
?>
<ul class="list-group">
<?php
$week = 1;
while($row = $result->fetch_assoc()) {
?>
<li class="list-group-item"><?php echo "Semana #" . $week?></li><br>
<li class="list-group-item"><?php echo "Cintura: " . $row['cintura'] . " - " . "Abdomen: " . $row['abdomen'] . " - " . "Peso: " . $row['peso']?></li><br>
<li class="list-group-item"><?php echo "Estatura: " . $row['estatura'] . " - " . "Grasa: " . $row['grasa'] . " - " . "Masa muscular: " . $row['masa_muscular']?></li><br>
<?php
$week = $week + 1;
}
?>
</ul>
<?php
}
$conn->close();
?>
</body>
</html>