bonsoir , je veux insérer les variables dans la base de données
mais ça ne marche pas !! pourquoi?!!
erreur Array ( [0] => 42000 [1] => 1064 [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 ) 1
mercii
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?php //model include ("includes/session.php"); $conn = $pdo->open(); $idpr = $_POST['var1']; $quantity = $_POST['quantity']; $idc = $_POST['var2']; if(isset($_SESSION['id'])){ $stmt = $conn->prepare("INSERT INTO commandeatt (idProduit, idClient , qte , dateCommande) VALUES ( :productid , :userid, :quantity, NOW()"); $stmt->execute(['productid'=>$idpr,'userid'=>$idc, 'quantity'=>$quantity]); }else{ echo ""; } header("Location: single.php?idProduit=".$idpr."&id=".$_SESSION['id']); $pdo->close(); ?>
Partager