Compare data in a file with data in a DB

Dear all ,

i would like to know if email in a file is in my database and return me only wich are not

her is my code :
[php]$tabmail = array();

//on fait un tableau avec les mails en base
$query = “select email from wp_MailPress_users”;
$exec = mysql_query($query);
while ( $stockmail = mysql_fetch_row($exec))

$n = sizeof($tabmail);
echo “Nombre de mails en base: “.$n.”

Les Emails ci dessous ne sont pas en base :


//on lance la comparaison

$ficmail = fopen(“tmp/fullmail.txt”,“r”);
while ($line = fgets($ficmail))
$tabline = explode("\t", trim($line));
$email = $tabline[8];
$nom = $tabline[2];
$cp = $tabline[5];

if(!in_array($email, $tabmail))
 echo "<br />".$line;


but it return me all mails in my file … where is my mistake please ?

Bst Rgds

The code seem to be fine. Are you sure you read email from the file properly in this line:
[php]$email = $tabline[8];[/php]
Try to debug this by echo-ing $email immediately after this assignment.

Sponsor our Newsletter | Privacy Policy | Terms of Service