跳到主要內容

Checking the Connection to my MySql Database (PHP Codes)

Checking the Connection to my MySql Database (PHP Codes)


 <?php 

$servername = "<<Server Name>>"; 

$username = "<<Your username>>"; 

$password = "<<Your Password>>"; 

$dbname = "<<Database Name>>"; 


// Create connection

 $conn = new mysqli($servername, $username, $password, $dbname); 


// Check connection 

if ($conn->connect_error) 

          die("Connection failed: " . $conn->connect_error); 

}

echo "Connected successfully"; $conn->close(); 

?>

Source Code on GitHub


留言

這個網誌中的熱門文章

PHP Signature Pad & Upload on server

In this tutorial, We will learn how to use  an e-signature pad using jquery  ajax and save image to the database using PHP.  Download  E-Signature Pad Jquery plugin from here    http://keith-wood.name/signature.html Step 1: Create  index.php  file and put the following code: PHP Signature Pad Example PHP Signature Pad Example Signature: Clear Signature Step 2: Create  upload.php  file  PHP Signature Pad Example PHP Signature Pad Example Signature: Clear Signature Step 3: Create  upload  directory where our signature file upload. This is dest...