Bonjour,
j'ai une page connexion.php pour se connecter à une base mysql par PDO et je l'appelle dans la fonction d'une autre page test.php mais ça ne marche pas.
page connexion.php
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
$utilisateur='root';
$motDePasse='';
$dsn='mysql:host=localhost;dbname=db_sms';
try{
$con=new PDO($dsn, $utilisateur, $motDePasse, array(PDO::ATTR_PERSISTENT => true));
$con->exec("SET CHARACTER SET utf8");
} catch (PDOException $e){
print "Erreur : ".$e->getMessage()."<br />";
die();
}
?>
test.php
<?php
function appele(){
include 'connexion.php'
}