file array not adding complete contents to db

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tbbd
Forum Newbie
Posts: 20
Joined: Sat Apr 22, 2006 2:54 pm

file array not adding complete contents to db

Post 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
tbbd
Forum Newbie
Posts: 20
Joined: Sat Apr 22, 2006 2:54 pm

Post 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
Post Reply