Quelques chose comme:
<?php
$n=0;
$sql='SELECT * FROM table1';
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
while($data = mysql_fetch_array($req))
{
$sql2 = 'SELECT * FROM table2 WHERE mail="'.$data['mail'].'"';
$req2 = mysql_query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
$nb2 = mysql_fetch_array($req));
if($nb2!=0)
{
$sql3='DELETE FROM table2 WHERE mail="'.$data['mail'].'"';
mysql_query($sql3) or die('Erreur SQL !<br />'.$sql3.'<br />'.mysql_error());
$n++;
}
}
echo $n.' mails supprimés';
?>
0 commentaires:
Enregistrer un commentaire