Bonjour, je me prend une SYNTAX ERROR SQL ,
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':genre_personne, :nom_personne, :prenom_personne, :age_personne, :telephone_per' at line 2
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
 
 
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ffnpro_v2";
 
try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username,
        $password);
// set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $genre_personne=$_POST["genre_personne"];
    $nom_personne=$_POST["nom_personne"];
    $prenom_personne=$_POST["prenom_personne"];
    $age_personne=$_POST["age_personne"];
    $telephone_personne=$_POST["telephone_personne"];
    $email_personne=$_POST["email_personne"];
    $adresse_personne=$_POST["adresse_personne"];
    $codep_personne=$_POST["codep_personne"];
    $ville_personne=$_POST["ville_personne"];
    $pays_personne=$_POST["pays_personne"];
    $type = $_POST["type"];
    $centre_emetteur=$_POST["centre_emetteur"];
    $licence=$_POST["licence"];
 
 
 
// query sql and bind parameters
$stmt = $conn->query("INSERT INTO personnes (genre_personne, nom_personne, prenom_personne, age_personne, telephone_personne,
email_personne, adresse_personne, codep_personne, ville_personne, pays_personne, type, centre_emetteur, licence,centre_emetteur_region,date_current) VALUES (:genre_personne, :nom_personne,
:prenom_personne, :age_personne, :telephone_personne, :email_personne, :adresse_personne, :codep_personne, :ville_personne, :pays_personne, :type, :centre_emetteur, :licence, :centre_emetteur_region ,CURRENT_DATE())");
$stmt->bindParam(':genre_personne', $genre_personne);
$stmt->bindParam(':nom_personne', $nom_personne);
$stmt->bindParam(':prenom_personne', $prenom_personne);
$stmt->bindParam(':age_personne', $age_personne);
$stmt->bindParam(':telephone_personne', $telephone_personne);
$stmt->bindParam(':email_personne', $email_personne);
$stmt->bindParam(':adresse_personne', $adresse_personne);
$stmt->bindParam(':codep_personne', $codep_personne);
$stmt->bindParam(':ville_personne', $ville_personne);
$stmt->bindParam(':pays_personne', $pays_personne);
$stmt->bindParam(':type', $type);
$stmt->bindParam(':centre_emetteur', $centre_emetteur);
$stmt->bindParam(':licence', $licence); 
$stmt->bindParam(':centre_emetteur_region', $centre_emetteur_region); 
 
 
$stmt->execute();
Je ne comprend vraiment pas , peut-être que d'un point de vue exterieur ce sera plus facile !
Je récupère bien tout en POST :

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
Array
(
    [genre_personne] => mme
    [type] => adulte
    [nom_personne] => ioi
    [prenom_personne] => ojioij
    [email_personne] => joijoi@fr.fr
    [telephone_personne] => hui
    [age_personne] => 11111-11-11
    [adresse_personne] => oijijo
    [codep_personne] => joioji
    [ville_personne] => jio
    [pays_personne] => France
    [centre_emetteur] => FEDERATION FRANCAISE DE NATURISME
    [licence] => 2019-120769 
    [centre_emetteur_region] => ILE DE FRANCE
    [register] => 
)
Je vous remercie d'avance !