Page 1 sur 1

UPDATE SQL

Posté : 01 août 2009, 08:55
par Sebb66
Bonjour,

Je souhaiterai modifier un champ d'une de mes tables sur phpmyadmin (Version: 3.1.5)

Nom de ma table : match
Champ en question : id_season

J'exécute cette requête dans SQL

Code : Tout sélectionner

UPDATE match SET season_id='108' WHERE season_id='59'
Il me met ce message d'erreur :

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match SET season_id='108' WHERE season_id='59'' at line 1

Merci pour votre aide !


:wink:

Code : Tout sélectionner

CREATE TABLE IF NOT EXISTS `match` ( `match_id` int(11) NOT NULL auto_increment, `club_visitor_id` int(11) NOT NULL default '0', `club_home_id` int(11) NOT NULL default '0', `team_visitor_id` int(11) default NULL, `team_home_id` int(11) default NULL, `season_id` int(11) default '108', `competition_id` int(11) NOT NULL default '0', `round_id` int(11) NOT NULL, `field_state_id` int(11) NOT NULL default '0', `field_id` int(11) NOT NULL default '0', `weather_id` int(11) NOT NULL default '0', `vent_id` int(11) NOT NULL default '0', `television_id` int(11) NOT NULL, `match_date` datetime NOT NULL default '0000-00-00 00:00:00', `match_group` text collate latin1_general_ci NOT NULL, `match_day` tinyint(4) NOT NULL, `match_penality_home` tinyint(4) NOT NULL, `match_penality_visitor` tinyint(4) NOT NULL, `match_score_home` tinyint(6) default NULL, `match_score_visitor` smallint(6) default NULL, `match_spectators` int(13) default NULL, `match_comment` text collate latin1_general_ci, `match_photo` text collate latin1_general_ci NOT NULL, `referee_id` text collate latin1_general_ci NOT NULL, PRIMARY KEY (`match_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2846 ;

Re: UPDATE SQL

Posté : 01 août 2009, 17:50
par Victor BRITO
MATCH () est une fonction de MYSQL.

Re: UPDATE SQL

Posté : 01 août 2009, 17:56
par dunbar
Il me met ce message d'erreur :

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match SET season_id='108' WHERE season_id='59'' at line 1
Concernant cette erreur je pense que cela est dû aux guillement normalement ' 59 ' toi ' 59 "
essaye avec deux guillement simple et pas un simple et un double :P

Re: UPDATE SQL

Posté : 02 août 2009, 17:34
par enneite
mouais ou alors si les id sont des nombres, on peut carrément enlever les quotes.
Victor a peut être raison, match est peut être un mot réservé pour MYSQL.
Mais si la table se créée bien et que le problème ne se pose qu'à l'UPDATE, je trouve cela bizarre, mais c'est à vérifier, essaie de renommer la table.

Re: UPDATE SQL

Posté : 02 août 2009, 18:46
par Sékiltoyai
match est peut être un mot réservé pour MYSQL.
C'est pas mal :)
match est un mot réservé pour MYSQL.
C'est mieux :)

Re: UPDATE SQL

Posté : 02 août 2009, 21:06
par Victor BRITO
Mais si la table se créée bien et que le problème ne se pose qu'à l'UPDATE, je trouve cela bizarre, mais c'est à vérifier, essaie de renommer la table.
À défaut de pouvoir renommer la table, on peut en protéger le nom :

Code : Tout sélectionner

UPDATE `match` SET season_id = 108 WHERE season_id = 59