Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Contributor: adminMysqli Connection using PHP
#1
PHP Code:
<?php
$servername 
"localhost";//this is servername when you are using linux server you can also use ip address of servername
$username "username";
$password "password";
$dbname="database_name";

// Create connection 

$conn mysqli_connect($servername$username$password,$dbname);

// Check connection

if (!$conn) {
    die("Connection failed: " mysqli_connect_error());
}
else{
echo 
"Connected successfully";
}
?>
OUTPUT:
[Image: oKcgxts.png]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)