If I load my very simple web page it shows as blank with the PHP at the top
But if I remove the PHP my website loads the few headers I’ve created
<?php $servername = “localhost”; $username = “user”; $password = “password12345”; $dbname = “test”;
// Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }
// sql to create table $sql = “CREATE TABLE MyGuests ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, email VARCHAR(50), reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )”;
if ($conn->query($sql) === TRUE) { echo “Table MyGuests created successfully”; } else { echo "Error creating table: " . $conn->error; }
$conn->close(); ?>
deleted by creator
If you use code blocks it is easier to read.
<?php $servername = “localhost”; $username = “user”; $password = “password12345”; $dbname = “test”; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // sql to create table $sql = “CREATE TABLE MyGuests ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, email VARCHAR(50), reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )”; if ($conn->query($sql) === TRUE) { echo “Table MyGuests created successfully”; } else { echo "Error creating table: " . $conn->error; } $conn->close(); ?>
I managed to fix this btw
turns out I didn’t have a bunch of dependencies installed