29 lines
565 B
PHP
29 lines
565 B
PHP
<?php
|
|
|
|
class createCon
|
|
{
|
|
public $host = 'localhost';
|
|
public $user = 'spota_informatika';
|
|
public $pass = 'Eud!}ZML3HVO';
|
|
public $db = 'spota_spotadb';
|
|
|
|
public $myconn;
|
|
|
|
public function connect()
|
|
{
|
|
$con = new PDO('mysql:host='.$this->host.';dbname='.$this->db, $this->user, $this->pass);
|
|
if (!$con) {
|
|
die('Could not connect to database!');
|
|
} else {
|
|
$this->myconn = $con;
|
|
}
|
|
|
|
return $this->myconn;
|
|
}
|
|
|
|
public function close()
|
|
{
|
|
$this->myconn = null;
|
|
}
|
|
}
|