How to open a new connection to MySQL with MySQLi object-oriented in PHP

1 Answer

0 votes
$servername = "localhost";
$username = "your_username";
$password = "your_password";

$con = new mysqli($servername, $username, $password);

if ($con->connect_error) {
    die("Connection failed: " . $con->connect_error);
}
echo "Connection Success";

$con->close();

/*
run:

Connection Success

*/

 



answered Jan 7, 2016 by avibootz

Related questions

1 answer 232 views
232 views asked Apr 28, 2014 by avibootz
1 answer 219 views
1 answer 283 views
1 answer 238 views
...