IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PHP & Base de données Discussion :

Erreur de requête du a un nombre


Sujet :

PHP & Base de données

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2011
    Messages
    62
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2011
    Messages : 62
    Points : 31
    Points
    31
    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 : 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
     
    	$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 : 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
     
    $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>';
    						}

  2. #2
    Expert éminent sénior
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Points : 16 545
    Points
    16 545
    Billets dans le blog
    12
    Par défaut
    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.

  3. #3
    Expert éminent sénior
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Points : 16 545
    Points
    16 545
    Billets dans le blog
    12
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    $extensionsAutorisees = array('PDF', 'DOC');
    if ( ! in_array(strtoupper($extensionFichier), $extensionsAutorisees)) {

  4. #4
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2011
    Messages
    62
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2011
    Messages : 62
    Points : 31
    Points
    31
    Par défaut
    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 : 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
     
    	$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>';
    						}

  5. #5
    Expert éminent sénior
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Points : 16 545
    Points
    16 545
    Billets dans le blog
    12
    Par défaut
    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 ?

  6. #6
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2011
    Messages
    62
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2011
    Messages : 62
    Points : 31
    Points
    31
    Par défaut
    J'ais trois echo du avec un séparateur /

    voila le retour des trois echo /Array//

  7. #7
    Membre expert Avatar de RunCodePhp
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    2 962
    Détails du profil
    Informations personnelles :
    Localisation : Réunion

    Informations forums :
    Inscription : Janvier 2010
    Messages : 2 962
    Points : 3 947
    Points
    3 947
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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]

  8. #8
    Expert éminent sénior
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Points : 16 545
    Points
    16 545
    Billets dans le blog
    12
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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

  9. #9
    Expert éminent sénior
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Points : 16 545
    Points
    16 545
    Billets dans le blog
    12
    Par défaut
    Euh boulette ici :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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

  10. #10
    Membre expert Avatar de RunCodePhp
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    2 962
    Détails du profil
    Informations personnelles :
    Localisation : Réunion

    Informations forums :
    Inscription : Janvier 2010
    Messages : 2 962
    Points : 3 947
    Points
    3 947
    Par défaut
    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]

  11. #11
    Expert éminent sénior
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Points : 16 545
    Points
    16 545
    Billets dans le blog
    12
    Par défaut
    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.

  12. #12
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2011
    Messages
    62
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2011
    Messages : 62
    Points : 31
    Points
    31
    Par défaut
    je vous avoue c'est la première fois que j'ai une erreur de ce type et je comprend pas grand chose ....

  13. #13
    Membre expert Avatar de RunCodePhp
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    2 962
    Détails du profil
    Informations personnelles :
    Localisation : Réunion

    Informations forums :
    Inscription : Janvier 2010
    Messages : 2 962
    Points : 3 947
    Points
    3 947
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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]

  14. #14
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2011
    Messages
    62
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2011
    Messages : 62
    Points : 31
    Points
    31
    Par défaut
    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....

  15. #15
    Membre expert Avatar de RunCodePhp
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    2 962
    Détails du profil
    Informations personnelles :
    Localisation : Réunion

    Informations forums :
    Inscription : Janvier 2010
    Messages : 2 962
    Points : 3 947
    Points
    3 947
    Par défaut
    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]

  16. #16
    Expert éminent sénior
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Points : 16 545
    Points
    16 545
    Billets dans le blog
    12
    Par défaut
    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.

  17. #17
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2011
    Messages
    62
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2011
    Messages : 62
    Points : 31
    Points
    31
    Par défaut
    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 : 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
     
    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 ;

  18. #18
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2011
    Messages
    62
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2011
    Messages : 62
    Points : 31
    Points
    31
    Par défaut
    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.

  19. #19
    Membre expert Avatar de RunCodePhp
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    2 962
    Détails du profil
    Informations personnelles :
    Localisation : Réunion

    Informations forums :
    Inscription : Janvier 2010
    Messages : 2 962
    Points : 3 947
    Points
    3 947
    Par défaut
    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]

  20. #20
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2011
    Messages
    62
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2011
    Messages : 62
    Points : 31
    Points
    31
    Par défaut
    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

Discussions similaires

  1. [MySQL] Erreur de requête
    Par Sebe dans le forum PHP & Base de données
    Réponses: 45
    Dernier message: 08/02/2006, 14h09
  2. [PHP MySQL] Erreur execution requête de type INSERT
    Par Pfeffer dans le forum Requêtes
    Réponses: 6
    Dernier message: 23/01/2006, 17h38
  3. [Debutant]Erreur Récurent - Requête
    Par ghan77 dans le forum Bases de données
    Réponses: 19
    Dernier message: 10/01/2006, 13h09
  4. erreur exécution requête
    Par MANU_2 dans le forum Bases de données
    Réponses: 4
    Dernier message: 13/10/2005, 07h27
  5. Erreur de requête :-(
    Par pekka77 dans le forum ASP
    Réponses: 2
    Dernier message: 28/06/2005, 13h53

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo