-
Notifications
You must be signed in to change notification settings - Fork 0
/
seleccion.php
53 lines (47 loc) · 1.14 KB
/
seleccion.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
<html>
<body>
<?php
// Datos de la tabla
$servername = "localhost";
$username = "id9787747_admin";
$password = "!NPJ8jVdhssy%lr6GMkr";
$dbname = "id9787747_example";
//Creas la conexion
$conn = new mysqli($servername, $username, $password, $dbname);
//Checar la conexion
if($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id, name, email FROM ingenieros";
$result = $conn->query($sql);
echo "<table border='1'>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "</tr>";
}
echo "</table>";
$conn->close();
// if($result->num_rows > 0)
// {
// // Imprimes lo de cada columna
// while($row = $result->fetch_assoc())
// {
// echo "id: " . $row["id"]. " - Name: " . $row["name"]. " " . $row["email"]. "<br>";
// }
// }
// else
// {
// echo "0 results";
// }
// $conn->close();
?>