Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 39a0854c authored by First's avatar First
Browse files

Edit index.php

parent 603a9594
No related branches found
No related tags found
No related merge requests found
<?php
echo "65160381 Parinya Triyakun"
$servername = "db";
$username = "lab2-65160381";
$password = "mark254421.";
$dbname = "lab2-65160381";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM student";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "ID: " . $row["id"]. " - Name: " . $row["fname"]. " " . $row["lname"]. " - Score: " . $row["score"]."<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment