Bonjour à tous,

Voilà, je triture le code depuis 3 jours sur un problème de modification des valeurs d'une table.
Ci-dessous, deux fonctions: l'une marche, l'autre pas...
Je n'ai pas d'erreur PHP en logs.
Tout d'abord l'erreur...
( ! ) Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 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 'WHERE ID = '7'' at line 6' in Z:\www\admin\modif_pack.php on line 21
( ! ) PDOException: SQLSTATE[42000]: Syntax error or access violation: 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 'WHERE ID = '7'' at line 6 in Z:\www\admin\modif_pack.php on line 21
Call Stack
# Time Memory Function Location
1 0.0008 675464 {main}( ) ..\index.php:0
2 0.0164 733120 include( 'Z:\www\admin\modif_pack.php' ) ..\index.php:67
3 0.0164 735456 PDOStatement->execute( ) ..\modif_pack.php:21
Je ne suis pas particulièrement doué, et je dois avoir perdu mes lunettes. car je ne pige plus rien. le code est le suivant :

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
if(isset($_POST['submit'])){
	$reqInscription = "UPDATE packs SET 
			nombre = :nombre,
			offert = :offert,
			prix = :prix,
			parrain = :parrain,
		WHERE ID = :ID";
	$resInscription = $dbh->prepare($reqInscription, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
 
	$resInscription->execute(array(
		'nombre' => $_POST['nombre'],
		'offert' => $_POST['offert'],
		'prix' => $_POST['prix'],
		'parrain' => $_POST['parrain'],
		'ID' => $_GET['id']
	));
Pour le meme type de requete, j'ai un autre code qui lui fonctionne :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
$stmt = $dbh->prepare("UPDATE news SET 
				texte = :texte, 
				titre = :titre 
			WHERE id = :id");
 
			$stmt->execute(array(
				'texte' => $_POST['tMCE_news'],
				'titre' => $_POST['titre'],
				'id' => $_GET['id']
			));

la deuxième fonctionne, pas la première. Et je ne comprends pas...
Si ça se trouve il y a un truc gros comme un iceberg, mais je ne vois pas.
Je vous livre aussi 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
--
-- Structure de la table `packs`
--
 
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `nombre` int(11) NOT NULL,
  `offert` int(11) NOT NULL,
  `prix` double NOT NULL,
  `parrain` int(11) NOT NULL,
   PRIMARY KEY (`ID`)
 
--
-- Structure de la table `news`
--
 
  `id` int(12) NOT NULL AUTO_INCREMENT,
  `titre` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `texte` longtext COLLATE latin1_general_ci NOT NULL,
  `date_ecriture` datetime NOT NULL,
  PRIMARY KEY (`id`)

D'avance merci !