Show sourcecode
The following files exists in this folder. Click to view.
webbsrvprg/exercises/ovning9/1/
laggatill.php
skapatabell.php
skriverut.php
tabort.php
uppdatera.php
skriverut.php
41 lines ASCII Windows (CRLF)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Select</title>
</head>
<body>
<?php
include ('../dbconnection.php');
try {
/*** The SQL SELECT statement ***/
$sql = "SELECT * FROM kompisar";
$stmt = $dbconn->prepare($sql);
$data = array();
$stmt->execute($data);
$output = "<table><h1>Tabell!</h1>";
while ($res = $stmt->fetch(PDO::FETCH_ASSOC)) {
$output .= "<tr>".
"<td>".htmlentities($res['idnummer'])."</td>".
"<td>".htmlentities($res['firstname'])."</td>".
"<td>".htmlentities($res['lastname'])."</td>".
"<td>".htmlentities($res['mobil'])."</td>".
"<td>".htmlentities($res['email'])."</td>".
"</tr>";
}
$output .= "</table>";
echo "$output";
}
catch(PDOException $e)
{
echo $sql . "<br />" . $e->getMessage();
}
$dbconn = null;
?>
<a href="../ovn_sql1.php">Tillbaks till meny</a>
</body>
</html>