Hi everyone,
I have a database of around 6,000 emails, the model is called NewsLetter. I also have a text file with around 1,400 emails written line by line with no space like so;
nyzil77@yahoo.com
puthukkudi@hotmail.com
anwer@hidada.com.sa
....
These emails are taken from my database because they are not valid, I extracted all emails that do not send. What I want to do is read the text file emails and match with my DB emails so I can delete them. This is what I have
$handle = fopen("http://www.something.com/Library/bouncingEmails.txt", "r");
if ($handle) {
while (($line = fgets($handle)) !== false) {
$line = (string)$line;
$token = explode("\n", $line);
$n = NewsLetter::model()->findAll('Email = :Email', array(':Email' => $line));
foreach ($n as $y){
echo $y->Email."<br />";
This doesn’t work, it just loads slowly and displays nothing, the file is being read because echo $line works perfectly. I know the emails match because if I manually type an email into findAll it matches. Can anyone tell me why this doesn’t work and how to?
Thanks