Connecting to mysql

From MyWiki
Revision as of 17:46, 10 November 2014 by George2 (Talk | contribs)

Jump to: navigation, search
////Example (MySQLi Procedural)
<?php
$servername = "localhost";
$username = "username";
$password = "password";
 
// Create connection
$conn = mysqli_connect($servername, $username, $password);
 
// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
echo 
 
 
//closing the connection 
Example (MySQLi Procedural)
mysqli_close($conn);