Commit 5d112e7d authored by Shoaib Ahmed's avatar Shoaib Ahmed

adding index.php file for 3 tier app

parents
<?php
$servername = "db";
$username = "root";
$password = "Qwerty123";
$dbname = "message";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id, message, reg_date FROM message";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. " - Message: " . $row["message"]. " " . $row["reg_date"]. "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment