Bonjour à tous,

J'ai une erreur à la ligne 37 mais je ne sais pas de quoi elle proviens, pouvez-vous m'aider s'il vous plait ?

Merci d'avance

Parse error: syntax error, unexpected end of file in C:\wamp64\www\ResponsiveForm\Actionlogement.php on line 37

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
 
 <?php
 $db = include 'db_mysql.php'; 
 
try {
	$stmt = $db->prepare("INSERT INTO logement (LOG_DEBUT, LOG_RUE, LOG_COMPLEMENT, LOG_CP, LOG_VILLE, LOG_TYPE, LOG_APT) 
VALUES (:LOG_DEBUT, :LOG_RUE, :LOG_COMPLEMENT, :LOG_CP, :LOG_VILLE, :LOG_TYPE, :LOG_APT)");
    $stmt->bindParam(':LOG_DEBUT', $LOG_DEBUT);
    $stmt->bindParam(':LOG_RUE', $LOG_RUE);
    $stmt->bindParam(':LOG_COMPLEMENT', $LOG_COMPLEMENT);
	    $stmt->bindParam(':LOG_CP', $LOG_CP);
    $stmt->bindParam(':LOG_VILLE', $LOG_VILLE);
    $stmt->bindParam(':LOG_TYPE', $LOG_TYPE);
	    $stmt->bindParam(':LOG_APT', $LOG_APT);
 
// insert a row
    $LOG_DEBUT = $_POST["LOG_DEBUT"];
    $LOG_RUE = $_POST["LOG_RUE"];
    $LOG_COMPLEMENT = $_POST["LOG_COMPLEMENT"];
	$LOG_CP = $_POST["LOG_CP"];
    $LOG_VILLE = $_POST["LOG_VILLE"];
    $LOG_TYPE = $_POST["LOG_TYPE"];
	$LOG_APT = $_POST["LOG_APT"];
 
    $stmt->execute();
    echo "New records created successfully";
   }
   //ceci n'est pas une exception 
   //il n'y a peut etre pas de CHAZAL avec un prénom qui commence par un C et dont l’id est strictement supérieur à 2
 
 catch (Exception $e) {
   //s'il y a un problème PHP ou SQL, tout s'affichera ici
   print "Erreur ! " . $e->getMessage() . "<br/>";
 
 
$pdo = null;
 header('Location: http://localhost/ResponsiveForm/index.php');
?>

le fichier db_mysql.php:
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
// @author : rawsrc - 2018 - Pour DVP
// on vérifie si la fonction de connexion a déjà été définie afin d'éviter de la redéfinir
if ( ! function_exists('db_connexion')) {
   function db_connexion() {
      // une fois ouverte, on renvoie toujours la même connexion
      static $pdo;
      // on vérifie si la connexion n'a pas déjà été initialisée
      if ( ! ($pdo instanceof PDO)) {
         // tentative d'ouverture de la connexion MySQL
         try {
            $pdo = new PDO('mysql:host=localhost;port=3306;dbname=testsql;charset=utf8','root', '', [
            PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
            PDO::ATTR_EMULATE_PREPARES   => false
            ]);
         } 
         catch (PDOException $e) {
            throw new InvalidArgumentException('Erreur connexion à la base de données : '.$e->getMessage());
            exit;
         }
      }
      // renvoi de la ressource : connexion à la base de données
      return $pdo;
   }
}
return db_connexion();
?>