Facebook Page
Tuesday, September 29, 2015
Friday, September 11, 2015
Database Connection in PHP and Mysqli with OOPs concept
<?php
class Connect{
public $hostname = 'localhost';
public $username = 'root';
public $password = '';
public $database = 'test';
public $db;
public function conn(){
$db = new mysqli($this->hostname, $this->username, $this->password, $this->database);
if($db->connect_errno){
echo "database connection error found";
}else
{
echo "database connect successfully!";
}
}
}
$conn = new Connect();
$conn->conn();
?>
Output: database connect successfully!
class Connect{
public $hostname = 'localhost';
public $username = 'root';
public $password = '';
public $database = 'test';
public $db;
public function conn(){
$db = new mysqli($this->hostname, $this->username, $this->password, $this->database);
if($db->connect_errno){
echo "database connection error found";
}else
{
echo "database connect successfully!";
}
}
}
$conn = new Connect();
$conn->conn();
?>
Output: database connect successfully!
Monday, September 7, 2015
Saturday, September 5, 2015
Subscribe to:
Posts (Atom)