Object-oriented connection method; indentation
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
<?php
|
||||
//Step1
|
||||
$db = mysqli_connect('localhost','root','','database_name')
|
||||
or die('Error connecting to MySQL server.');
|
||||
$servername = "localhost";
|
||||
$username = "root";
|
||||
$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>
|
||||
|
||||
Reference in New Issue
Block a user