ajout connexion
This commit is contained in:
parent
2eb333edfb
commit
cf97e02c21
3 changed files with 17 additions and 0 deletions
3
models/close_connection.php
Normal file
3
models/close_connection.php
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?php
|
||||||
|
unset($connex);
|
||||||
|
?>
|
||||||
14
models/connection.php
Normal file
14
models/connection.php
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a PDO connection
|
||||||
|
* @return PDO
|
||||||
|
*/
|
||||||
|
function connection() {
|
||||||
|
//Loads config from file config.php
|
||||||
|
require('config/config.php');
|
||||||
|
|
||||||
|
//Db connection
|
||||||
|
$connex = new PDO('mysql:host=' . HOST . ';dbname=' . DB,USER , PASSWORD);
|
||||||
|
return $connex;
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue