Problème de requete sql + php

evenkil Messages postés 35 Date d'inscription lundi 13 février 2006 Statut Membre Dernière intervention 15 avril 2014 - 5 janv. 2007 à 20:47
evenkil Messages postés 35 Date d'inscription lundi 13 février 2006 Statut Membre Dernière intervention 15 avril 2014 - 5 janv. 2007 à 21:36
Bonjour
Je post ce message car depuis hier j'ai une erreur dans mon script, et rien a faire je n'arrive pas a la corriger. Auriez vous la gentillesse de regarder si une erreur vous saute aux yeux ?
J'ai mis en gras là ou il semble y avoir un problème
Voici la source :

<?
require('../../../connection.php');
//RECUPERATION DES DONNEES
$id= $_POST['id'];
$nom=$_POST['nom'];
$description=$_POST['description'];
$photo1=$_POST['photo1'];
$photo2=$_POST['photo2'];
$photo3=$_POST['photo3'];
$video=$_POST['video'];
$metier1=$_POST['metier1'];
$metier2=$_POST['metier2'];
$metier3=$_POST['metier3'];
$id_categorie=$_POST['categorie'];
$niveau=$_POST['niveau'];
echo '
Nom : ';
echo $nom;
echo '
Description : ';
echo $description;
echo '
';
echo $photo1;
echo '
';
echo $photo2;
echo '
Photo3 : ';
echo $photo3;
echo '
Video : ';
echo $video;
echo '
Metier1 : ';
echo $metier1;
echo '
Metier2 : ';
echo $metier2;
echo '
Metier3 : ';
echo $metier3;
echo '
ID categorie : ';
echo $id_categorie;
echo '
Niveau : ';
echo $niveau;
echo '
ID: ';
echo $id;
//MISE A JOUR DES DONNEES
$requete_photo1 =mysql_db_query($sql_bdd,"UPDATE formation SET nom= "$nom", description="$description", photo1="$photo1", photo2="$photo2", photo3="$photo3", video="$video", "$metier1", "$metier2", "$metier3", id_categorie="$id_categorie", niveau="$niveau" WHERE id="$id"",$db_link) or die(mysql_error());
//FIN, ON CONFIRME LA REQUETE A L'UTILISATEUR
echo " La formation a été modifié avec succès
";
echo "<SCRIPT LANGUAGE ='JavaScript'>setTimeout('window.location= \'index.php?page=formation/modifier_formation\'',5000);</SCRIPT>";
echo "Vous serez redirigé automatiquement sur la page de modification des formations dans 5 secondes";
?>

Voici le resultat:

Nom : Technique Installation Sanitaire et Technique
Description : Elles nécessitent un niveau général moyen, correct en technologie. La formation comporte 8 semaines de stage.
../Photo/f_1_1.jpg
../Photo/f_1_2.jpg
Photo3 : ../Photo/f_1_3.jpg
Video : n/A
Metier1 : ascensoriste
Metier2 : 0
Metier3 : 0
ID categorie : 3
Niveau : BAC PRO
ID:
2You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '"ascensoriste", "0", "0", id_categorie ="3", niveau="BAC PRO" WHE

Merci beaucoup pour votre aide.
Cordialement

4 réponses

Bling 182 Messages postés 510 Date d'inscription lundi 27 novembre 2006 Statut Membre Dernière intervention 5 juillet 2009 3
5 janv. 2007 à 21:10
Salut !

Forcement, si dans un update tu ne mets pas le nom des colones (metier1, metier2, metier3) il va t'envoyer bouler...
0
evenkil Messages postés 35 Date d'inscription lundi 13 février 2006 Statut Membre Dernière intervention 15 avril 2014
5 janv. 2007 à 21:21
Beh si, voici ma table sql :
FORMATION(nom,description, photo1, photo2 etc ....)
A chaque fois je lui indique la colone et la valeur à prendre
0
Bling 182 Messages postés 510 Date d'inscription lundi 27 novembre 2006 Statut Membre Dernière intervention 5 juillet 2009 3
5 janv. 2007 à 21:26
$requete_photo1=mysql_db_query($sql_bdd,"UPDATE formation SET
nom="$nom", description="$description", photo1="$photo1",
photo2="$photo2", photo3="$photo3", video="$video", "$metier1",
"$metier2", "$metier3", id_categorie="$id_categorie",
niveau="$niveau" WHERE id="$id"",$db_link) or die(mysql_error());

"ou pas"

Il faudrait mettre metier1="$metier1",metier2="$metier2",metier3="$metier3",
0
evenkil Messages postés 35 Date d'inscription lundi 13 février 2006 Statut Membre Dernière intervention 15 avril 2014
5 janv. 2007 à 21:36
Merci beaucoup ^^
Voici comment plancher 1 jour sur un simple oublie :p
Encore merci ;)
0
Rejoignez-nous