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
| if (isset($_POST['rajouter']) && $_POST['rajouter']=="Valider")
{
$content = $BDD->prepare('SELECT * FROM block WHERE Fabriquant= ?, Materiau= ?, Taille= ?, Luminosite= ?, Teinte= ?');
$content->execute(array(
$_POST['fabriquant'],
$_POST['materiau'],
$_POST['taille'],
$_POST['luminosite'],
$_POST['teinte']
));
$reponse = $content->fetch();
if ($reponse != False)
{
echo("Un tel bloc existe dèjà");
echo($reponse['Frabriqant']." ".$reponse['Materiau']." ".$reponse['Taille']." ".$reponse['Luminosite']." ".$reponse['Teinte']);
}
else
{
echo("on peut ecrire le nouvel enregistrement");
$req = $basedonnees->prepare('INSERT INTO block (Fabriquant, Materiau, Taille, Luminosite, Teinte, Nombre)
VALUE(:fabriquant, :materiau, :taille, :luminosite, :teinte, :nombre)');
$req->execute(array(
'fabriquant' => $_POST['fabriquant'],
'materiau' => $_POST['materiau'],
'taille' => $_POST['taille'],
'luminosite' => $_POST['luminosite'],
'teinte' => $_POST['teinte'],
'nombre' => $_POST['nombre']
));
}
$content->closeCursor();
} |
Partager