file array not adding complete contents to db
Posted: Thu May 11, 2006 4:22 am
I have a file that has 517 lines fo email addresses...I wanted to add the contents of the file to the db
Here is the code I used
After I run the file, I check the db and there is only 127 lines in the table....I emptied the table and redid it, same thing still
I have no idea why it wont add the entire file
**The main.php file that is included is only the functions for connecting to the db and the header/footer
Here is the code I used
Code: Select all
<?php
include_once("core/main.php");
//file to use
$listfile = "mail_list_users.txt";
//read file contents into array
$lines = file($listfile);
foreach ($lines as $line)
{
//add each user's email to db
$mlins = "INSERT into mail_list( email, active ) VALUES ( '$line', 'Y' )";
$mlret = db_query($mlins);
}
?>I have no idea why it wont add the entire file
**The main.php file that is included is only the functions for connecting to the db and the header/footer