Bonjour,

Je suis en train d'essayer de faire un site pour mon club de foot avec match, classement ..., je bloque sur la mise à jour des matchs.

J'ai un tableau avec mes matchs, au bout de la ligne, un bouton modifier qui me redirige vers un formulaire :

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<fieldset>
					<legend>Mise à jour d'un match</legend>
				<table>
<?php
    $req = $bdd->prepare('
	SELECT match.id AS `match_id`, journee, DATE_FORMAT(date, \'%d/%m/%Y\') AS date, dom.nom AS `dom_nom`, ext.nom AS `ext_nom`,  buts_dom, buts_ext, statut.statut AS `statut_nom`
	FROM `match`, `equipe` AS dom, `equipe` AS ext, `match_statut` AS statut
	WHERE id_equipe_dom=dom.id 
	AND id_equipe_ext=ext.id 
	AND match.id=\'' . $_GET['match_id'] . '\'
	GROUP BY match.id
	');
    $req->execute(array($_GET['match_id']));
	while ($donnees = $req->fetch())
	{
?>
				<form action="update_match.php" method="post">
				<tr>
					<td>
						<label for="match_id">ID du match</label> : 
					</td>
					<td>
						<?php echo ''.$donnees["match_id"].' ';?>
					</td>
				</tr>
				<tr>
					<td>
						<label for="journee">Journée</label> : 
					</td>
					<td>
						<?php echo ''.$donnees["journee"].' ';?>
					</td>
				</tr>
				<tr>
					<td>
						<label for="date">Date</label> : 
					</td>
					<td>
						<input type="text" name="date" id="date" size="10" value="<?php echo ''.$donnees["date"].' ';?>"/>  (exemple 31/07/2011)
					</td>
				</tr>
				<tr>
					<td>
						<label for="dom_nom">Match</label> : 
					</td>
					<td>
						<?php echo ''.$donnees["dom_nom"].' ';?> - <?php echo ''.$donnees["ext_nom"].' ';?>
					</td>
				</tr>
				<tr>
					<td>
						<label for="buts_dom">Score</label> : 
					</td>
					<td>
						<input type="text" name="buts_dom" id="buts_dom" size="3" value="<?php echo ''.$donnees["buts_dom"].' ';?>"/> - <input type="text" name="buts_ext" id="buts_ext" size="3" value="<?php echo ''.$donnees["buts_ext"].' ';?>"/>
					</td>
				</tr>
				<tr>
					<td>
						<label for="statut_nom">Statut</label> : 
					</td>
					<td>
						<select name="statut_nom" id="id_match_statut" value="<?php echo ''.$donnees["statut_nom"].' ';?>"/>
					<option value="1" <?php if ($donnees["statut_nom"] == "1") {echo("selected");}?> >Match à jouer</option>
					<option value="2" <?php if ($donnees["statut_nom"] == "2") {echo("selected");}?> >Match joué</option>
					<option value="3" <?php if ($donnees["statut_nom"] == "3") {echo("selected");}?> >Forfait domicile</option>
					<option value="4" <?php if ($donnees["statut_nom"] == "4") {echo("selected");}?> >Forfait exterieur</option></select>
					</td>
				</tr>
				<tr>
				<td>
                	<a href="admin_match.php"><img src="../images/retour.png" alt="Retour" title="Retour" /></a>
				</td>
				<td>
					<input type="submit" value="Mettre à jour"/>
				</td>
<?php
//On ferme la boucle while
 }
?>
				</table>
			</fieldset>
Le formulaire est bien pré-rempli, j'ai juste à mettre la date, les buts domiciles, extérieur et le statut du match en fonction de l'id du match.

J'ai construit ma page update_match de cette façon :

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
<?php
	{ 
	       // lancement de la requête
		$req = $bdd->prepare('
		UPDATE match 
		SET date="'.$_POST['date'].'", 
		buts_dom="'.$_POST['buts_dom'].'", 
		buts_ext="'.$_POST['buts_ext'].'", 
		id_match_statut="'.$_POST['id_match_statut'].'"
		WHERE id="'.$_POST['match_id'].'"'); 
 
		$req->execute(array(
		'date' => $_POST['date'], 
		'buts_dom' => $_POST['buts_dom'], 
		'buts_ext' => $_POST['buts_ext'], 
		'id_match_statut' => $_POST['id_match_statut']
		));
 
    // Redirection vers la page d'administration
	header('Location: admin_match.php');
	}   
?>
J'ai les messages :

Notice: Undefined index: id_match_statut in F:\wampee\www\xxx\admin\update_match.php on line 23
Notice: Undefined index: match_id in F:\wampee\www\xxx\admin\update_match.php on line 24
Notice: Undefined index: id_match_statut in F:\wampee\www\xxx\admin\update_match.php on line 30
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 ' in F:\wampee\www\xxx\admin\update_match.php on line 31
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 'match SET date="28/05/2011 ", buts_dom="0 ", buts_ext="4 ", id_m' at line 1 in F:\wampee\www\xxx\admin\update_match.php on line 31
ça fait deux heures que j'y suis et je ne vois pas le bout

Si quelqu'un à une idée ?