Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD > PHP & MySQL
PHP & MySQL Forum d'entraide sur les fonctions MySQL avec PHP. Avant de poster -> FAQ MySQL, Cours MySQL et Sources MySQL. Pour les questions concernant le moteur MySQL plutôt que les fonctions PHP, merci d'utiliser le forum MySQL.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 26/11/2011, 12h15   #1
Invité régulier
 
Inscription : avril 2011
Messages : 60
Détails du profil
Informations forums :
Inscription : avril 2011
Messages : 60
Points : 9
Points : 9
Par défaut Erreur de requête du a un nombre

Bonjour a tous,
Je n'arrive pas a trouvé l'erreur que me retourne la console.

erreur : Invalid parameter number: number of bound variables does not match number of tokens

code :

Code :
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
 
	$candidat = $connexion -> prepare("INSERT INTO candidats SET nom=:nom, prenom=:prenom, adresse=:adresse, departement=:departement, email=:email', tel=:tel, date=:date, sit_fam=:sit_fam, age=:age, formation=:formation, experience=:experience, langue=:langue, divers=:divers, cv=:cv, poste=:poste, poste2=:poste2, poste3=:poste3', poste4=:poste4, 1departement=:1departement, 1departement2=:1departement2, 1departement3=:1departement3, 1departement4=:1departement4, 1region=:1region, id_user=:id_user, preavis=:preavis, salaire=:salaire, commentaire=:commentaire, gestion=:gestion, produits=:produits, management=:management, divers_eval=:divers_eval ");
	$candidat -> bindParam('nom', $_POST['nom']);
	$candidat -> bindParam('prenom', $_POST['prenom']);
	$candidat -> bindParam('adresse', $_POST['adresse']);
	$candidat -> bindParam('departement', $_POST['dept'], PDO::PARAM_INT);
	$candidat -> bindParam('email', $_POST['email']);
	$candidat -> bindParam('tel', $_POST['tel'], PDO::PARAM_INT);
	$candidat -> bindParam('date', date('Y,m,d'));
	$candidat -> bindParam('sit_fam', $_POST['sit_fam']);
	$candidat -> bindParam('age', $_POST['jour'], PDO::PARAM_INT);
	$candidat -> bindParam('formation', $_POST['forma']);
	$candidat -> bindParam('experience', $_POST['expe']);
	$candidat -> bindParam('langue', $_POST['langue']);
	$candidat -> bindParam('divers', $_POST['divers']);
	$candidat -> bindParam('cv', $_POST['cv']);
	$candidat -> bindParam('poste', $_POST['poste']);
	$candidat -> bindParam('poste2', $_POST['poste2'], PDO::PARAM_INT);
	$candidat -> bindParam('poste3', $_POST['poste3'], PDO::PARAM_INT);
	$candidat -> bindParam('poste4', $_POST['poste4'], PDO::PARAM_INT);
	$candidat -> bindParam('1departement', $_POST['dept'], PDO::PARAM_INT);
	$candidat -> bindParam('1departement2', $_POST['dept2'], PDO::PARAM_INT);
	$candidat -> bindParam('1departement3', $_POST['dept3'], PDO::PARAM_INT);
	$candidat -> bindParam('1departement4', $_POST['dept4'], PDO::PARAM_INT);
	$candidat -> bindParam('1region', $_POST['region'], PDO::PARAM_INT);
	$candidat -> bindParam('id_user', $_SESSION['admin_id'], PDO::PARAM_INT);
	$candidat -> bindParam('preavis', $_POST['preavis']);
	$candidat -> bindParam('salaire', $_POST['salaire'], PDO::PARAM_INT);
	$candidat -> bindParam('commentaire', $_POST['divers']);
	$candidat -> bindParam('gestion', $_POST['gestion']);
	$candidat -> bindParam('produits', $_POST['produits']);
	$candidat -> bindParam('management', $_POST['management']);
	$candidat -> bindParam('divers_eval', $_POST['com'], PDO::PARAM_INT);
	$candidat -> execute();
Le deuxième soucis concerne l'upload. si quelqu'un voit une erreur sa serait sympas si jamais je trouve la solutions je passe vous informer. concernant l'upload il me dit que l'extenssion du fichier est invalide.

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
$nomOrigine = $_FILES['cv']['name'];
	echo $nomOrigine.'/';
	$elementsChemin = pathinfo($nomOrigine);
	echo $elementsChemin.'/';
	$extensionFichier = $elementsChemin['extension'];
	echo $extensionFichier.'/';
	$extensionsAutorisees = array('PDF', 'pdf', 'doc');
				if (!(in_array($extensionFichier, $extensionsAutorisees))) 
					{
   					echo '<div class="notification error png_bg"><div>Le fichier n\'a pas l\'extension attendue, <a href="#">Retour</a></div></div>';
					}
					else
						{
						$repertoireDestination = 'répertoire de destination';
    					$nomDestination = ''.$nombre.'_'.clean_url($article_titre).'.'.$extensionFichier.'';
						move_uploaded_file($_FILES["cv"]["tmp_name"],$repertoireDestination.$nomDestination);
 
						echo '<div class="bo_sign">
							<center>Le candidat à bien été ajouté <a href="#">retour</a></center>
		 				 </div>';
						}
le nOoB est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 14h31   #2
Expert Confirmé
 
Avatar de rawsrc
 
Homme Martin
Dev indep
Inscription : mars 2004
Messages : 1 462
Détails du profil
Informations personnelles :
Nom : Homme Martin
Âge : 35
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Dev indep

Informations forums :
Inscription : mars 2004
Messages : 1 462
Points : 2 552
Points : 2 552
Envoyer un message via Skype™ à rawsrc
Citation:
Envoyé par le nOoB Voir le message
Bonjour a tous,
Je n'arrive pas a trouvé l'erreur que me retourne la console.

erreur : Invalid parameter number: number of bound variables does not match number of tokens
Regardes dans ta chaine SQL à ces endroits Tu as des ' qui trainent.
__________________
# Dans la Création, tout est permis mais tout n'est pas utile...
rawsrc est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 14h37   #3
Expert Confirmé
 
Avatar de rawsrc
 
Homme Martin
Dev indep
Inscription : mars 2004
Messages : 1 462
Détails du profil
Informations personnelles :
Nom : Homme Martin
Âge : 35
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Dev indep

Informations forums :
Inscription : mars 2004
Messages : 1 462
Points : 2 552
Points : 2 552
Envoyer un message via Skype™ à rawsrc
Citation:
Envoyé par le nOoB Voir le message
Le deuxième soucis concerne l'upload. si quelqu'un voit une erreur sa serait sympas si jamais je trouve la solutions je passe vous informer. concernant l'upload il me dit que l'extenssion du fichier est invalide.
Je pense que tu n'as pas prévu tous les cas de figures entre les minuscules et majuscules dans le tableau des extensions autorisées :
Code :
1
2
$extensionsAutorisees = array('PDF', 'DOC');
if ( ! in_array(strtoupper($extensionFichier), $extensionsAutorisees)) {
__________________
# Dans la Création, tout est permis mais tout n'est pas utile...
rawsrc est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 18h02   #4
Invité régulier
 
Inscription : avril 2011
Messages : 60
Détails du profil
Informations forums :
Inscription : avril 2011
Messages : 60
Points : 9
Points : 9
J'ais fait les modification mais pas de réel changement :

erreur retourné : le fichier n'a pas l'extension attendue et Invalid parameter number: number of bound variables does not match number of tokens

Code :
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
 
	$candidat = $connexion -> prepare("INSERT INTO candidats SET nom=:nom, prenom=:prenom, adresse=:adresse, departement=:departement, email=:email, tel=:tel, date=:date, sit_fam=:sit_fam, age=:age, formation=:formation, experience=:experience, langue=:langue, divers=:divers, cv=:cv, poste=:poste, poste2=:poste2, poste3=:poste3, poste4=:poste4, 1departement=:1departement, 1departement2=:1departement2, 1departement3=:1departement3, 1departement4=:1departement4, 1region=:1region, id_user=:id_user, preavis=:preavis, salaire=:salaire, commentaire=:commentaire, gestion=:gestion, produits=:produits, management=:management, divers_eval=:divers_eval ");
	$candidat -> bindParam('nom', $_POST['nom']);
	$candidat -> bindParam('prenom', $_POST['prenom']);
	$candidat -> bindParam('adresse', $_POST['adresse']);
	$candidat -> bindParam('departement', $_POST['dept'], PDO::PARAM_INT);
	$candidat -> bindParam('email', $_POST['email']);
	$candidat -> bindParam('tel', $_POST['tel'], PDO::PARAM_INT);
	$candidat -> bindParam('date', date('Y,m,d'));
	$candidat -> bindParam('sit_fam', $_POST['sit_fam']);
	$candidat -> bindParam('age', $_POST['jour'], PDO::PARAM_INT);
	$candidat -> bindParam('formation', $_POST['forma']);
	$candidat -> bindParam('experience', $_POST['expe']);
	$candidat -> bindParam('langue', $_POST['langue']);
	$candidat -> bindParam('divers', $_POST['divers']);
	$candidat -> bindParam('cv', $_POST['cv']);
	$candidat -> bindParam('poste', $_POST['poste']);
	$candidat -> bindParam('poste2', $_POST['poste2'], PDO::PARAM_INT);
	$candidat -> bindParam('poste3', $_POST['poste3'], PDO::PARAM_INT);
	$candidat -> bindParam('poste4', $_POST['poste4'], PDO::PARAM_INT);
	$candidat -> bindParam('1departement', $_POST['dept'], PDO::PARAM_INT);
	$candidat -> bindParam('1departement2', $_POST['dept2'], PDO::PARAM_INT);
	$candidat -> bindParam('1departement3', $_POST['dept3'], PDO::PARAM_INT);
	$candidat -> bindParam('1departement4', $_POST['dept4'], PDO::PARAM_INT);
	$candidat -> bindParam('1region', $_POST['region'], PDO::PARAM_INT);
	$candidat -> bindParam('id_user', $_SESSION['admin_id'], PDO::PARAM_INT);
	$candidat -> bindParam('preavis', $_POST['preavis']);
	$candidat -> bindParam('salaire', $_POST['salaire'], PDO::PARAM_INT);
	$candidat -> bindParam('commentaire', $_POST['divers']);
	$candidat -> bindParam('gestion', $_POST['gestion']);
	$candidat -> bindParam('produits', $_POST['produits']);
	$candidat -> bindParam('management', $_POST['management']);
	$candidat -> bindParam('divers_eval', $_POST['com'], PDO::PARAM_INT);
	$candidat -> execute();
 
	// Uplod du cv dans ../Upload/cv/
	$nomOrigine = $_FILES['cv']['name'];
	echo $nomOrigine.'/';
	$elementsChemin = pathinfo($nomOrigine);
	echo $elementsChemin.'/';
	$extensionFichier = $elementsChemin['extension'];
	echo $extensionFichier.'/';
	$extensionsAutorisees = array('PDF', 'pdf', 'doc');
				if (! in_array(strtoupper($extensionFichier), $extensionsAutorisees)) 
					{
   					echo '<div class="bo_sign"><center>Le fichier n\'a pas l\'extension attendue, <a href="#">Retour</a></center></div>';
					}
					else
						{
						$repertoireDestination = 'chemin fichier';
    					$nomDestination = ''.$nombre.'_'.clean_url($article_titre).'.'.$extensionFichier.'';
						move_uploaded_file($_FILES["cv"]["tmp_name"],$repertoireDestination.$nomDestination);
 
						echo '<div class="bo_sign">
							<center>Le candidat à bien été ajouté <a href="#">retour</a></center>
		 				 </div>';
						}
le nOoB est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 18h11   #5
Expert Confirmé
 
Avatar de rawsrc
 
Homme Martin
Dev indep
Inscription : mars 2004
Messages : 1 462
Détails du profil
Informations personnelles :
Nom : Homme Martin
Âge : 35
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Dev indep

Informations forums :
Inscription : mars 2004
Messages : 1 462
Points : 2 552
Points : 2 552
Envoyer un message via Skype™ à rawsrc
Est-ce-que tu es absolument sûr que toutes les valeurs attendues sont dans le tableau $_POST ?
Est-ce-que echo $extensionFichier.'/'; te renvoie bien une extension ?
__________________
# Dans la Création, tout est permis mais tout n'est pas utile...
rawsrc est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 19h25   #6
Invité régulier
 
Inscription : avril 2011
Messages : 60
Détails du profil
Informations forums :
Inscription : avril 2011
Messages : 60
Points : 9
Points : 9
J'ais trois echo du avec un séparateur /

voila le retour des trois echo /Array//
le nOoB est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 19h34   #7
Expert Confirmé
 
Avatar de RunCodePhp
 
Inscription : janvier 2010
Messages : 2 727
Détails du profil
Informations personnelles :
Localisation : Réunion

Informations forums :
Inscription : janvier 2010
Messages : 2 727
Points : 3 294
Points : 3 294
Salut

La syntaxe que tu utilise pour faire une insertion n'est pas bonne (sauf erreur).
(c'est un mélange d'un INSERT et d'un UPDATE).

La syntaxe c'est théoriquement comme ceci :
Code sql :
1
2
3
4
 
INSERT INTO
nom_table (champ1, champ2, champN)
VALUES (val1, val2, valN)
Puis aussi, le nombre de champs renseigné (champ1, champ2) DOIT être le même que le nombre de valeurs dans le VALUES (valeur_champ1, valeur_champ2)
Si le nombre (couple : renseigné/valeur) n'est pas concordant, alors ça va générer une erreur genre : number of bound variables does not match number of tokens, que tu as.

Le nombre de champs renseignées :
1/ nom=:nom
2/ prenom=:prenom
3/ adresse=:adresse
4/ departement=:departement
5/ email=:email, tel=:tel
6/ date=:date
7/ sit_fam=:sit_fam
8/ age=:age
9/ formation=:formation
10/ experience=:experience
11/ langue=:langue
12/ divers=:divers
13/ cv=:cv
14/ poste=:poste
15/ poste2=:poste2
16/ poste3=:poste3
17/ poste4=:poste4
18/ 1departement=:1departement
19/ 1departement2=:1departement2
20/ 1departement3=:1departement3
21/ 1departement4=:1departement4
22/ 1region=:1region
23/ id_user=:id_user
24/ preavis=:preavis
25/ salaire=:salaire
26/ commentaire=:commentaire
27/ gestion=:gestion
28/ produits=:produits
29/ management=:management
30/ divers_eval=:divers_eval

Les valeurs
:
1/ $candidat -> bindParam('nom', $_POST['nom']);
2/ $candidat -> bindParam('prenom', $_POST['prenom']);
3/ $candidat -> bindParam('adresse', $_POST['adresse']);
4/ $candidat -> bindParam('departement', $_POST['dept'], PDO:ARAM_INT);
5/ $candidat -> bindParam('email', $_POST['email']);
6/ $candidat -> bindParam('tel', $_POST['tel'], PDO:ARAM_INT);
7/ $candidat -> bindParam('date', date('Y,m,d'));
8/ $candidat -> bindParam('sit_fam', $_POST['sit_fam']);
9/ $candidat -> bindParam('age', $_POST['jour'], PDO:ARAM_INT);
10/ $candidat -> bindParam('formation', $_POST['forma']);
11/ $candidat -> bindParam('experience', $_POST['expe']);
12/ $candidat -> bindParam('langue', $_POST['langue']);
13/ $candidat -> bindParam('divers', $_POST['divers']);
14/ $candidat -> bindParam('cv', $_POST['cv']);
15/ $candidat -> bindParam('poste', $_POST['poste']);
16/ $candidat -> bindParam('poste2', $_POST['poste2'], PDO:ARAM_INT);
17/ $candidat -> bindParam('poste3', $_POST['poste3'], PDO:ARAM_INT);
18/ $candidat -> bindParam('poste4', $_POST['poste4'], PDO:ARAM_INT);
19/ $candidat -> bindParam('1departement', $_POST['dept'], PDO:ARAM_INT);
20/ $candidat -> bindParam('1departement2', $_POST['dept2'], PDO:ARAM_INT);
21/ $candidat -> bindParam('1departement3', $_POST['dept3'], PDO:ARAM_INT);
22/ $candidat -> bindParam('1departement4', $_POST['dept4'], PDO:ARAM_INT);
23/ $candidat -> bindParam('1region', $_POST['region'], PDO:ARAM_INT);
24/ $candidat -> bindParam('id_user', $_SESSION['admin_id'], PDO:ARAM_INT);
25/ $candidat -> bindParam('preavis', $_POST['preavis']);
26/ $candidat -> bindParam('salaire', $_POST['salaire'], PDO:ARAM_INT);
27/ $candidat -> bindParam('commentaire', $_POST['divers']);
28/ $candidat -> bindParam('gestion', $_POST['gestion']);
29/ $candidat -> bindParam('produits', $_POST['produits']);
30/ $candidat -> bindParam('management', $_POST['management']);
31/ $candidat -> bindParam('divers_eval', $_POST['com'], PDO:ARAM_INT);

Si je ne me trompe pas, il y a 30 de renseignés, et 31 valeurs.
Ce n'est pas concordant, alors il y a quelque chose qu'il faudra corriger (une de trop, ou une à rajouter, ça dépent).
Hormis l'erreur de syntaxe à corriger aussi.
__________________
Win XP | WampServer 2.2d | Apache 2.2.21 | Php 5.3.10 | MySQL 5.5.20
Si debugger, c'est supprimer des bugs, alors programmer ne peut être que les ajouter [Edsger Dijkstra]
RunCodePhp est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 19h38   #8
Expert Confirmé
 
Avatar de rawsrc
 
Homme Martin
Dev indep
Inscription : mars 2004
Messages : 1 462
Détails du profil
Informations personnelles :
Nom : Homme Martin
Âge : 35
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Dev indep

Informations forums :
Inscription : mars 2004
Messages : 1 462
Points : 2 552
Points : 2 552
Envoyer un message via Skype™ à rawsrc
Citation:
Envoyé par RunCodePhp Voir le message
Salut

La syntaxe que tu utilise pour faire une insertion n'est pas bonne (sauf erreur).
(c'est un mélange d'un INSERT et d'un UPDATE).

La syntaxe c'est théoriquement comme ceci :
Code :
1
2
 
INSERT INTO nom_table (champ1, champ2, champN) VALUES (val1, val2, valN)
Tu te trompes, la syntaxe qu'il utilise est prévue pour faciliter l'INSERT et l'UPDATE, regardes ici
__________________
# Dans la Création, tout est permis mais tout n'est pas utile...
rawsrc est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 19h43   #9
Expert Confirmé
 
Avatar de rawsrc
 
Homme Martin
Dev indep
Inscription : mars 2004
Messages : 1 462
Détails du profil
Informations personnelles :
Nom : Homme Martin
Âge : 35
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Dev indep

Informations forums :
Inscription : mars 2004
Messages : 1 462
Points : 2 552
Points : 2 552
Envoyer un message via Skype™ à rawsrc
Euh boulette ici :
Code :
5/ email=:email, tel=:tel
Il a bien 31 champs des 2 côtés. Je les avais recompté mais n'ayant que 10 doigts j'ai eu peur de ne pas arriver à 31
__________________
# Dans la Création, tout est permis mais tout n'est pas utile...
rawsrc est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 19h45   #10
Expert Confirmé
 
Avatar de RunCodePhp
 
Inscription : janvier 2010
Messages : 2 727
Détails du profil
Informations personnelles :
Localisation : Réunion

Informations forums :
Inscription : janvier 2010
Messages : 2 727
Points : 3 294
Points : 3 294
Citation:
Tu te trompes, la syntaxe qu'il utilise est prévue pour faciliter l'INSERT et l'UPDATE
A ben ... c'est pas bien grave.
J'aurais appris quelque chose ce soir.

Toujours est il qu'il faut que les couples nom/valeur soient concordant, sinon ça n'ira pas quand même.
Suffit juste compter comme je l'ai fais plus haut, et ça se détecte tout de suite.
__________________
Win XP | WampServer 2.2d | Apache 2.2.21 | Php 5.3.10 | MySQL 5.5.20
Si debugger, c'est supprimer des bugs, alors programmer ne peut être que les ajouter [Edsger Dijkstra]
RunCodePhp est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 19h51   #11
Expert Confirmé
 
Avatar de rawsrc
 
Homme Martin
Dev indep
Inscription : mars 2004
Messages : 1 462
Détails du profil
Informations personnelles :
Nom : Homme Martin
Âge : 35
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Dev indep

Informations forums :
Inscription : mars 2004
Messages : 1 462
Points : 2 552
Points : 2 552
Envoyer un message via Skype™ à rawsrc
Citation:
Envoyé par RunCodePhp Voir le message
Suffit juste compter comme je l'ai fais plus haut, et ça se détecte tout de suite.
__________________
# Dans la Création, tout est permis mais tout n'est pas utile...
rawsrc est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 19h54   #12
Invité régulier
 
Inscription : avril 2011
Messages : 60
Détails du profil
Informations forums :
Inscription : avril 2011
Messages : 60
Points : 9
Points : 9
je vous avoue c'est la première fois que j'ai une erreur de ce type et je comprend pas grand chose ....
le nOoB est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 19h55   #13
Expert Confirmé
 
Avatar de RunCodePhp
 
Inscription : janvier 2010
Messages : 2 727
Détails du profil
Informations personnelles :
Localisation : Réunion

Informations forums :
Inscription : janvier 2010
Messages : 2 727
Points : 3 294
Points : 3 294
Citation:
Envoyé par le nOoB
Il a bien 31 champs des 2 côtés. Je les avais recompté mais n'ayant que 10 doigts j'ai eu peur de ne pas arriver à 31
Exact.


C'est quand même à notre ami le nOoB à utiliser la bonne technique pour le pas se tromper dans le nombre de champ, comme faire des saut de lignes, au lieu de tout mettre sur 1 ligne.
Puis soit disant que les SET soient mieux, pas si sur.
Code :
1
2
3
4
5
6
7
8
9
10
 
INSERT INTO nom_table (
champ1,
champ2
)
VALUES
(
:val1,
:val2
)
Si on procède ainsi, on ne devrait pas se tromper.
Essai avec cette syntaxe (plus courante à mon sens), et fait des saut de lignes, plus facile à compter.


Puis de toute manière il y a des erreurs de conceptions, il y a trop de champ dans cette table.
Cette table n'est pas conforme (3NF si je me trompe pas).
Faudrait théoriquement revoir le concept des champs :
poste, poste2, poste3, poste4
1departement, 1departement2, 1departement3, 1departement4.
etc ...
Mais là c'est une autre histoire.
__________________
Win XP | WampServer 2.2d | Apache 2.2.21 | Php 5.3.10 | MySQL 5.5.20
Si debugger, c'est supprimer des bugs, alors programmer ne peut être que les ajouter [Edsger Dijkstra]
RunCodePhp est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 26/11/2011, 20h10   #14
Invité régulier
 
Inscription : avril 2011
Messages : 60
Détails du profil
Informations forums :
Inscription : avril 2011
Messages : 60
Points : 9
Points : 9
Je suis tout a fait d'accord avec toi concernant la table concerné mais elle était la avant moi comme tout le reste du site ce qui n'est gère mieux concernat les autre table....
le nOoB est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 20h12   #15
Expert Confirmé
 
Avatar de RunCodePhp
 
Inscription : janvier 2010
Messages : 2 727
Détails du profil
Informations personnelles :
Localisation : Réunion

Informations forums :
Inscription : janvier 2010
Messages : 2 727
Points : 3 294
Points : 3 294
Citation:
je vous avoue c'est la première fois que j'ai une erreur de ce type et je comprend pas grand chose ....
As tu vérifier les valeurs et leur nombre dans le $_POST comme cela a été dit auparavant ?
Là aussi faut que le nombre soient le bon.

Si un champ n'accepte pas une valeur NULL (genre valeur POST inexistante), ça peu provoquer une erreur.

Mais pour savoir au moins si la requête est bonne, mets y des valeur "en dur" et valide (au lieu de mettre celles de $_POST). Une ou 2 fois comme ça.


Il y a toujours moyen de valider une partie de son code pour ne serait-ce pour éliminer une partie.
Après on recherche ailleurs, du coté de $_POST par exemple.
__________________
Win XP | WampServer 2.2d | Apache 2.2.21 | Php 5.3.10 | MySQL 5.5.20
Si debugger, c'est supprimer des bugs, alors programmer ne peut être que les ajouter [Edsger Dijkstra]
RunCodePhp est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 20h17   #16
Expert Confirmé
 
Avatar de rawsrc
 
Homme Martin
Dev indep
Inscription : mars 2004
Messages : 1 462
Détails du profil
Informations personnelles :
Nom : Homme Martin
Âge : 35
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Dev indep

Informations forums :
Inscription : mars 2004
Messages : 1 462
Points : 2 552
Points : 2 552
Envoyer un message via Skype™ à rawsrc
Citation:
Envoyé par le nOoB Voir le message
J'ais trois echo du avec un séparateur /

voila le retour des trois echo /Array//
ça veut dire que ton fichier n'existe pas. Tu n'as que les slashs que t'as concaténé aux valeurs de pathinfo($nomOrigine);La conséquence logique est que tu ne peux pas avoir d'extension de fichier vu que le fichier est inexistant.
__________________
# Dans la Création, tout est permis mais tout n'est pas utile...
rawsrc est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 21h12   #17
Invité régulier
 
Inscription : avril 2011
Messages : 60
Détails du profil
Informations forums :
Inscription : avril 2011
Messages : 60
Points : 9
Points : 9
Concernant les post voici le retour (précision j'ai retiré un champ inutile )

nom
prenom
adresse
1
email
1234567890
2011/11/26
famille
2011
formations
experience
langue
playchargekit_amer_0609.pdf
164
164
164
164
1
1
1
1
22
1
preavis
1234
divers
gestions
produits
management
commentaire

la structure de la table

Code :
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
 
CREATE TABLE IF NOT EXISTS `candidats` (
  `id_candidat` int(15) NOT NULL AUTO_INCREMENT,
  `nom` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `prenom` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `adresse` text CHARACTER SET latin1,
  `departement` int(5) DEFAULT NULL,
  `email` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
  `tel` varchar(70) CHARACTER SET latin1 DEFAULT NULL,
  `date` date DEFAULT NULL,
  `sit_fam` varchar(250) CHARACTER SET latin1 DEFAULT NULL,
  `age` varchar(10) CHARACTER SET latin1 DEFAULT NULL,
  `parcours` text CHARACTER SET latin1,
  `formation` text CHARACTER SET latin1,
  `experience` text CHARACTER SET latin1,
  `langue` varchar(250) CHARACTER SET latin1 DEFAULT NULL,
  `divers` text CHARACTER SET latin1,
  `cv` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
  `archive` tinyint(1) DEFAULT '0',
  `poste` int(10) DEFAULT NULL,
  `poste2` int(10) DEFAULT NULL,
  `poste3` int(10) DEFAULT NULL,
  `poste4` int(10) DEFAULT NULL,
  `valide` tinyint(1) DEFAULT '0',
  `sexe` char(1) CHARACTER SET latin1 DEFAULT NULL,
  `1departement` int(5) DEFAULT NULL,
  `1departement2` int(5) DEFAULT NULL,
  `1departement3` int(5) DEFAULT NULL,
  `1departement4` int(5) DEFAULT NULL,
  `1region` int(5) DEFAULT NULL,
  `alerte` tinyint(1) DEFAULT '0',
  `alerte_valide` tinyint(1) DEFAULT '0',
  `id_user` int(10) DEFAULT '0',
  `preavis` varchar(250) CHARACTER SET latin1 DEFAULT NULL,
  `salaire` varchar(100) CHARACTER SET latin1 DEFAULT NULL,
  `commentaire` text CHARACTER SET latin1,
  `courrier` tinyint(1) DEFAULT '0',
  `mag_type` tinyint(1) DEFAULT NULL,
  `mag_type2` tinyint(1) DEFAULT NULL,
  `mag_type3` tinyint(1) DEFAULT NULL,
  `mag_type4` tinyint(1) DEFAULT NULL,
  `date_envoi` varchar(15) CHARACTER SET latin1 DEFAULT NULL,
  `gestion` text CHARACTER SET latin1,
  `produits` text CHARACTER SET latin1,
  `management` text CHARACTER SET latin1,
  `divers_eval` text CHARACTER SET latin1,
  PRIMARY KEY (`id_candidat`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_bin AUTO_INCREMENT=15983 ;
le nOoB est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/11/2011, 01h51   #18
Invité régulier
 
Inscription : avril 2011
Messages : 60
Détails du profil
Informations forums :
Inscription : avril 2011
Messages : 60
Points : 9
Points : 9
Concernant la requête j'ai trouvé d'ou provenait l'erreur exemple

1departement=:departement et non 1departement=:1departement ce qui comme les variable commençant par un chiffre provoque une erreur.
le nOoB est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/11/2011, 06h51   #19
Expert Confirmé
 
Avatar de RunCodePhp
 
Inscription : janvier 2010
Messages : 2 727
Détails du profil
Informations personnelles :
Localisation : Réunion

Informations forums :
Inscription : janvier 2010
Messages : 2 727
Points : 3 294
Points : 3 294
Citation:
Envoyé par le nOoB
1departement=:departement et non 1departement=:1departement ce qui comme les variable commençant par un chiffre provoque une erreur.
A ben, tordu comme erreur.

Au passage, tu devrais plutôt utiliser bindValue() au lieu de bindParam(), ou bindParam() est plus fait pour des insertions/update multiples.
La valeur d'ailleurs "passe" "par référence" au lieu de "par valeur" pour bindValue().


Et pense y pour les champs comme poste, posteN, 1departement, 1departementN, mag_type, mag_typeN.
Si tu peux bien évidemment.
En tout cas il y a une relation 0-N entre ces données, et du coup il faudrait créer d'autres tables pour cela.

Exemple pour les données posteN.
-> Supprimer tous ces champs posteN de cette table
-> créer une table "candidats_postes" (champs) : id_candidat_postes | id_candidat
(idem pour les autres champs)
Ce qui fait qu'il pourra avoir aucun "poste" pour un candidat, et pour d'autres 1, 5, 10, ... N postes : Il n'y aura pas de limite, sans compter que c'est bien plus pratique lors des mise à jours.
Dans ton cas, s'il faut 1 poste de plus pour ne serait-ce pour 1 candidat, il faut rajouter un nouveau champ dans cette table candidat, ce qui n'est pas pratique (et non conforme).
__________________
Win XP | WampServer 2.2d | Apache 2.2.21 | Php 5.3.10 | MySQL 5.5.20
Si debugger, c'est supprimer des bugs, alors programmer ne peut être que les ajouter [Edsger Dijkstra]
RunCodePhp est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/11/2011, 15h09   #20
Invité régulier
 
Inscription : avril 2011
Messages : 60
Détails du profil
Informations forums :
Inscription : avril 2011
Messages : 60
Points : 9
Points : 9
Donc si j'ais bien compris BindParam pour les INSERT et UPDATE et Bindvalue pour le reste.

Concernant l'upload du fichier j'avais oublié enctype="multipart/form-data" en premier lieu ensuite apparait une erreur avec move_upload :

Voici le retour des echo : playchargekit_amer_0609.pdf/Array/pdf/

Message d'erreur : Warning: move_uploaded_file(): open_basedir restriction in effect. File(/home/www/URL du site/upload/cv/_.pdf) is not within the allowed path(s): (/var/www/clients/client3/web297/web:/var/www/clients/client3/web297/tmp:/var/www/URL du site/web:/srv/www/dev.URL du site/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client3/web297/web/admin/modules/Candidats/index.php on line 396
le nOoB est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 07h37.


 
 
 
 
Partenaires

Hébergement Web