Object-oriented connection method; indentation
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user