Saturday, 19 August 2017

Make MySQL database connection with oops

Here is the code for Make MySQL database connection with oops:

class config
{
var $servername;
var $username;
var $password;
var $database;
function database($servername, $username, $password, $database)
{

$conn=new mysqli($this->servername,$this->username,$this->password,$this->database);
if($conn->connect_error){
die("connection failed".$conn->connect_error);

}

}
}
$connect_database = new config();
$connect_database->database("localhost", "root", "", "oops");

No comments:

Post a Comment

Google Map Filter Api Example

Here is Google Map Filter Api Example: