<?php Class MaClasse { public function Ajouter($user, $bgue, $type, $email, $ip) { try{ $date = getdate(); $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; $bdd = new PDO('mysql:host=localhost;dbname=mybd', 'root', '', $pdo_options); //$bdd = Connexion(); $sql = "INSERT INTO tb_bg(id_bg, bg, date, type) VALUES('', '$bg', '$date', '$type')"; $reponse = $bdd->exec($sql); $resp = $bdd->query("SELECT MAX(id_bg) from tb_bg"); while ($data = $resp->fetch()) { $id = $data[0]; echo '#'.$id.' '; } //suite }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question