Object-oriented connection method; indentation

This commit is contained in:
WilliamMiceli
2019-11-21 20:22:14 -05:00
parent 8c8f697afb
commit 1433f31971

View File

@@ -1,7 +1,17 @@
<?php <?php
//Step1 $servername = "localhost";
$db = mysqli_connect('localhost','root','','database_name') $username = "root";
or die('Error connecting to MySQL server.'); $password = "";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?> ?>
<html> <html>