1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| try
{
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$bdd = new PDO('mysql:host=localhost;dbname=gestion_articles', 'root', '', $pdo_options);
$req = $bdd->prepare('INSERT INTO agence(lib_agence) VALUES(:login,:lib_agence)');
$req->execute(array(
'lib_agence' => $_POST['lib_agence'],
));
$req = $bdd->prepare('INSERT INTO marque(lib_marque) VALUES(:login,:lib_marque)');
$req->execute(array(
'lib_marque' => $_POST['lib_marque'],
));
$req = $bdd->prepare('INSERT INTO article(num,prix_achat,date_achat,duree_garantie) VALUES(:login,:num,:prix_achat,:date_achat,:duree_garantie)');
$req->execute(array(
'num' => $_POST['num'],
'prix_achat' => $_POST['prix_achat'],
'date_achat' => $_POST['date_achat'],
'duree_garantie' => $_POST['duree_garantie'],
));
header("Location:acquisition.php ");
}
catch (Exception $e)
{
die('Erreur : ' . $e->getMessage());
} |
Partager