Erreur de sintaxe SQL je comprend pas

Résolu
dadou9101 Messages postés 107 Date d'inscription   Statut Membre Dernière intervention   -  
dadou9101 Messages postés 107 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour, je n arrive pas a voir ou est mon ereur de sintaxe sur ma requete SQL

je veux en effet faire une modification de mon formulaire et j emploie cette requete la

UPDATE `checklist`.`magasin`
SET nom_mag = '$nom_mag',
ouv_mag = '$ouv_mag',
adr_mag = '$adr_mag',
adrliv_mag = '$adrliv_mag',
chefp_mag = '$chefp_mag',
cheft_mag = '$cheft_mag',
com_mag = '$com_mag',
comtel_mag = '$comtel_mag',
WHERE `magasin`.`id_mag` = 830920 LIMIT 1 ;

Pouvez vous m éclairez

6 réponses

loupius
 
Peut-être me fourvoyè-je, mais que signifie:
`checklist`.`magasin`
et
`magasin`.`id_mag`
A quoi correspond le point '.' ?
0
dadou9101 Messages postés 107 Date d'inscription   Statut Membre Dernière intervention   5
 
en faite je viens de corriger ma requete SQL

UPDATE `magasin` SET nom_mag = '$nom_mag',
ouv_mag = '$ouv_mag',
adr_mag = '$adr_mag',
adrliv_mag = '$adrliv_mag',
chefp_mag = '$chefp_mag',
cheft_mag = '$cheft_mag',
com_mag = '$com_mag',
comtel_mag = '$comtel_mag',
WHERE `id_mag` =830920 LIMIT 1 ;

mais meme la sa me met la meme erreur

cheklist correspont au nom de ma base de donne
et magasin au nom de ma table
0
P@t@ch0n Messages postés 565 Date d'inscription   Statut Membre Dernière intervention   85
 
Et l'erreur retournée est ?

Sert à quoi le LIMIT sachant qu'un identifiant est unique.
0
loupius
 
Peut-être me fourvoyè-je, mais que signifie:
`magasin`
et
`id_mag`
A quoi correspondent les quotes inversées '`' ?
0
P@t@ch0n Messages postés 565 Date d'inscription   Statut Membre Dernière intervention   85
 
Les quotes obliques, c'est un truc pourri de MySQL servant à pouvoir utiliser les mots réservés comme noms de bdd, tables ou colonnes.
0
dadou9101 Messages postés 107 Date d'inscription   Statut Membre Dernière intervention   5
 
Effectivement la limite me sert a rien mais jai toujours la meme erreur

UPDATE `cheklist`.`magasin` SET nom_mag = '$nom_mag',
ouv_mag = '$ouv_mag',
adr_mag = '$adr_mag',
adrliv_mag = '$adrliv_mag',
chefp_mag = '$chefp_mag',
cheft_mag = '$cheft_mag',
com_mag = '$com_mag',
comtel_mag = '$comtel_mag',
WHERE `magasin`.`id_mag` =830920;

#1064 - Erreur de syntaxe près de 'WHERE `magasin`.`id_mag` = 830920' à la ligne 9
0
loupius
 
Merci pour le renseignement.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
P@t@ch0n Messages postés 565 Date d'inscription   Statut Membre Dernière intervention   85
 
La virgule en trop juste avant le WHERE.
0
dadou9101 Messages postés 107 Date d'inscription   Statut Membre Dernière intervention   5
 
UPDATE `magasin`

SET
nom_mag = '$nom_mag',
ouv_mag = '$ouv_mag',
adr_mag = '$adr_mag',
adrliv_mag = '$adrliv_mag',
chefp_mag = '$chefp_mag',
cheft_mag = '$cheft_mag',
com_mag = '$com_mag',
comtel_mag = '$comtel_mag'

WHERE `magasin`.`id_mag` = '$id_mag'

sa fonctionne bien merci de m avoir eclairez
0