verifica
This commit is contained in:
parent
2c82d90dd4
commit
5f80048cec
20 changed files with 999 additions and 1 deletions
48
pdo/elenco_squadre/index.php
Normal file
48
pdo/elenco_squadre/index.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
$host = "192.168.1.20";
|
||||
$database = "tiro_piattello";
|
||||
$user = "pdo";
|
||||
$password = "";
|
||||
|
||||
$datiMedici = [];
|
||||
|
||||
try {
|
||||
$connection = new PDO("mysql:host=$host;dbname=$database", $user, $password);
|
||||
echo "Connected successfully<br>";
|
||||
|
||||
$prepare = $connection->prepare("SELECT id, nome, sede FROM squadra ORDER BY nome");
|
||||
$prepare->execute();
|
||||
if ($prepare->rowCount() > 0) {
|
||||
$datiMedici = $prepare->fetchAll();
|
||||
}
|
||||
$connection = null;
|
||||
|
||||
} catch (PDOException $e) {
|
||||
die ("Error!: " . $e->getMessage() . "<br/>");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>HTML</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
|
||||
>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main class="container">
|
||||
<h1>Lista squadra db</h1>
|
||||
<?php foreach ($datiMedici as $med) {
|
||||
echo "<h2>" . $med['nome'] . " </h2>";
|
||||
} ?>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue