connect_error) {
die("Connection failed: " . $conn->connect_error);
// echo "Connected successfully."; // Optional debug line
}
// Use backticks if table name has unusual characters/spaces
$sql = "SELECT id, first, last FROM `fallenworkerstestfinal`";
$result = $conn->query($sql);
?>
Fallen Workers List
Names
DOB |
First |
Last |
num_rows > 0) {
// Output data of each row
while ($row = $result->fetch_assoc()) {
echo "";
echo "" . htmlspecialchars($row["DOB"]) . " | ";
echo "" . htmlspecialchars($row["First"]) . " | ";
echo "" . htmlspecialchars($row["Last"]) . " | ";
echo "
";
}
} else {
echo "No results found |
";
}
$conn->close();
?>
------------------------------------------------------------------------------
⚠️ Important Notes
Database host:
$servername = "ftp.monumentoaicaduti.com";
This looks like an FTP host, not necessarily your MySQL/MariaDB host.
If your provider gave you a separate database host (often localhost, 127.0.0.1, or something like mysql.yourdomain.com), use that instead.
---------------------------------------------------------------------------------------------------------------
Using the wrong hostname will cause connection failures.
Credentials in code:
Storing raw DB passwords in PHP files is insecure. In production, move them into a separate config file outside the web root or environment variables.
----------------------------------------------------------------------------
Spaces in DB name:
Your DB name has spaces: jqnncp73imegtfsz_Italian Fallen Workers Memorial.
MySQL doesn’t like spaces in DB names unless wrapped in backticks. If this DB name is correct, change connection line to:
$dbname = "`jqnncp73imegtfsz_Italian Fallen Workers Memorial`";