"); $requet=" SELECT distinct `table3`.`Num1` as `X`, sum(`table3`.`Champ4`* '1.618') as `Y` FROM `table1`, `table3`, `table2` Where `table1`.`Num1`= `table3`.`Num1` AND `table2`.`Num2`=`table3`.`Num2` group by `table3`.`Num2` order by `Y` DESC"; $result=mysql_query($requet) or die("erreur de requete de base de données.
"); $fp=fopen("liste.txt","w+") or die("Erreur de création du fichier!!"); $ligne= mysql_fetch_row($result); while($ligne) { $num=$ligne[0]; $mont=$ligne[1]; fwrite($fp,$num); fwrite($fp,chr(13).chr(10)); fwrite($fp,$mont); fwrite($fp,chr(13).chr(10)); $ligne= mysql_fetch_row($result); } fclose($fp); ?>