prepare($req); $e= $query -> execute(); if (! $e) { die('Erreur de creation de base de données / '); } echo "DBB created successfully (or already exists)"; // Selection de la BDD $bdd = new PDO('mysql:host=' .$hostname . ';dbname=' . $database , $username, $password); if (! $bdd) { die('Probleme de connexion à la BDD...'); } echo "
BDD accessed successfully"; $req = "CREATE TABLE IF NOT EXISTS `produit` ( `Numprod` int(2) NOT NULL, `libeler` varchar(20) NOT NULL, `prix` decimal(6,2) NOT NULL, `quantite` int(3) NOT NULL, PRIMARY KEY (`Numprod`) )"; $query = $bdd -> prepare($req); $e= $query -> execute(); if (! $e) { die('Erreur de creation de table / '); } echo "
Produit Table was created successfully (or already exists)"; // On fait la même chose pour les autres tables ?>