-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtodo.php
More file actions
25 lines (23 loc) · 704 Bytes
/
Copy pathtodo.php
File metadata and controls
25 lines (23 loc) · 704 Bytes
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
<?php
$user = "root";
$password = "tsdevopsacp";
$dbhost = 'db';
$database = "todo_db";
$table = "todo_list";
echo "<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css\">
<div class=\"jumbotron text-center\">
<h2>TO-DO LIST</h1>
<p>My To-Do list powered by MySQL DB!</p>
</div>";
try {
$db = new PDO("mysql:host=$dbhost;dbname=$database", $user, $password);
echo "<div class=\"container\">
<ol>";
foreach($db->query("SELECT task FROM $table") as $row) {
echo "<li>" . $row['task'] . "</li>";
}
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
echo "</ol></div>";