Monday, 24 September 2018
Subscribe to:
Post Comments (Atom)
mysqli
class (mysqli::__construct
) which is an alias of mysqli_connect(). On successful connection, it returns an object which represents the connection.$con->connect_error
or mysqli_connect_error()
.mysqli::__construct(host_name, username, password, db_name, port, socket)
class mysqli {
__construct ($host_name, $username, $password, $db_name, $port, $socket)
}
$con = new mysqli($host_name, $username, $password, $db_name, $port, $socket);
<?php
$host_name = "localhost";
$username = "username";
$password = "password";
$database = "test";//database name
// Create connection
$con = new mysqli($host_name, $username, $password, $database);
// Check connection
if (!$con) {
echo "Error: " . $con->connect_error; die;
}
echo "Connection to database : ".$database." created successfully on server : ".$con->host_info;
?>
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment