<?php
include ('logue.php'); 
include ('entete2.php');

$req = "SELECT mail FROM matgraph_users WHERE id=idjoueur ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
$requete = "INSERT INTO matgraph_newsletter VALUES('','$row[mail]')";
$resultat = db_mysql_Query($requete)or die('erreur sql<br>'.$requete.'<br>'.mysql_error());

}}
/*
$req = "SELECT mail FROM matgraph_users WHERE id=idjoueur ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
echo"$row[mail]";
$req2 = "SELECT id FROM matgraph_newsletter WHERE adresse='$row[mail]' ORDER by id ASC";
$res2 = db_mysql_Query($req2) or die('Erreur SQL! <br>'.$req2.'<br>'.mysql_error());
$num2 = mysql_num_rows($res2);

if($num2 > 0) {
echo" Non ajouter<br>";}
else {

$requete = "INSERT INTO matgraph_newsletter VALUES('','$row[mail]')";
$resultat = db_mysql_Query($requete)or die('erreur sql<br>'.$requete.'<br>'.mysql_error());
echo" Ajouter<br>";}
}} 
*/

?>