Page 1 sur 1

Notice: Undefined index: montant in C:\wamp\www

Posté : 13 mars 2012, 16:15
par piotrowski-s
Bonjour à tous, j'ai cette requête ci qui me renvoit le message d'erreur sus-évoqué en titre. A priori, cela viendrait de la ligne 571
echo $data['montant'];
voici mon code
 (<?php $sql2 = 'SELECT SUM(montant) FROM versements WHERE n_doss=' . $_GET['n_doss'] . '';

$req2 = mysql_query ($sql2) or die ('Erreur SQL !<br>'.$sql2.'<br>'.mysql_error ()); 

while($data = mysql_fetch_assoc ($req2)) 

{

echo $data['montant'];

} ?>
D'avance merci.

Re: Notice: Undefined index: montant in C:\wamp\www

Posté : 13 mars 2012, 16:35
par Shenryu
Salut,
$sql2 = 'SELECT SUM(montant) AS montant FROM versements WHERE n_doss=' . $_GET['n_doss'];
Essaye de cette manière. Attention à l'injection SQL.

++