qr_id route php getDog
This commit is contained in:
24
php/php-dog/classes/Database.php
Normal file
24
php/php-dog/classes/Database.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
class Database{
|
||||
|
||||
// CHANGE THE DB INFO ACCORDING TO YOUR DATABASE
|
||||
private $db_host = 'localhost';
|
||||
//private $db_host = '10.35.232.188:3306';
|
||||
private $db_name = 'k200835_dog';
|
||||
private $db_username = 'k200835_user_dog';
|
||||
private $db_password = 'X0pEiBsXN3RLazGhQVvP';
|
||||
|
||||
public function dbConnection(){
|
||||
|
||||
try{
|
||||
$conn = new PDO('mysql:host='.$this->db_host.';dbname='.$this->db_name,$this->db_username,$this->db_password);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
return $conn;
|
||||
}
|
||||
catch(PDOException $e){
|
||||
echo "Connection error ".$e->getMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user