Page 1 of 1

file array not adding complete contents to db

Posted: Thu May 11, 2006 4:22 am
by tbbd
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

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);	
}

?>
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

Posted: Thu May 11, 2006 4:42 am
by tbbd
lol, I figured it out

I went to the lline in the file where it stopped and tried to add it manually to the db, got an id out of range error, I( had it set to TinyInt....o well