Bonjour tout le monde !
Après diverses recherches et de longues heures passés à me prendre la tête sur le script, je me tourne vers vous à la recherche d'une solution. J'ai ici un script qui récupère les informations d'un formulaire pour ensuite les stocker dans la BDD. Rien de bien innovant de ce côté là. Mais je suis complètement largué :
J'ai d'autres scripts similaires et eux fonctionnent parfaitement, c'est juste les noms des tables et des variables qui changent. Mais ce script laisse ma BDD désespérément vide et je ne comprend pas pourquoi. J'ai bien évidemment vérifié si ce n'était pas une faute d'orthographe glissée quelque part mais tout me semble correct ...

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
51
52
53
54
55
56
57
<?php
session_start();
if (!isset($_SESSION['id']))
{
    header('location: http://xxxxxxxx.fr/');
}
else
{
	try
	{
       $bdd = new PDO('mysql:host=;dbname=', '', '');
	}
	catch (PDOException $e)
	{
       echo '<br><a href="index.php">Retournez à la page précédente</a>';
       die('Erreur de connection : ' . $e->getMessage());
	}
 
	$select = $bdd->prepare('SELECT * FROM criteres WHERE mail = :mail');
	$select->execute(array(':mail' => $_SESSION['id']));
	if($select->fetchColumn() != 0)
	{
		$select->closeCursor();
		echo 'L\'adresse mail existe déjà !<br>';
		/*ADRESSE EXISTANTE = UPDATE DES INFORMATIONS*/
	}
	else
	{
		$select->closeCursor();	
		$req = $bdd->prepare('INSERT INTO criteres(mail, metier1, metier2, specialite1, specialite2, secteur1, secteur2, experience1, experience2, localisation, int) VALUES(:mail, :metier1, :metier2, :specialite1, :specialite2, :secteur1, :secteur2, :experience1, :experience2, :localisation, :int)');
		try
		{
			$req->bindValue(':mail', $_SESSION['id'], PDO::PARAM_STR);
			$req->bindValue(':metier1', $_POST['metier1'], PDO::PARAM_STR);
			$req->bindValue(':metier2', $_POST['metier2'], PDO::PARAM_STR);
			$req->bindValue(':specialite1', $_POST['specialite1'], PDO::PARAM_STR);
			$req->bindValue(':specialite2', $_POST['specialite2'], PDO::PARAM_STR);
			$req->bindValue(':secteur1', $_POST['secteur1'], PDO::PARAM_STR);
			$req->bindValue(':secteur2', $_POST['secteur2'], PDO::PARAM_STR);
			$req->bindValue(':experience1', $_POST['experience1'], PDO::PARAM_INT);
			$req->bindValue(':experience2', $_POST['experience2'], PDO::PARAM_INT);
			$req->bindValue(':localisation', $_POST['localisation'], PDO::PARAM_STR);
			$req->bindValue(':int', $_POST['int'], PDO::PARAM_STR);
 
			$req->execute();
			$req->closeCursor(); 
			echo 'Informations ajoutées !<br>';
			echo '<br><a href="index.php">Retournez à la page précédente</a>';
		}
		catch (PDOException $e)
		{
			echo '<br><a href="index.php">Retournez à la page précédente</a>';
			die('Erreur d\'insertion: ' . $e->getMessage());
		}
	}
}
?>
Si vous pouviez m'aider, je vous en serai très reconnaissant !
Merci d'avance