I am trying to convert a php script that reads a text file with email
addresses (1 per line) and puts them in a database into a CF script.
Here's the original php code
PHP
$filename="master_email.txt";
$fp=fopen($filename, "r");
$EmailList = fread ($fp, filesize ($filename));
$EmailList = explode ("\n",$EmailList);
$EmailList=(array_unique($EmailList));
$count=count($EmailList);
print $count."<br>";
sort($EmailList);
foreach($EmailList as $email)
{
if($email!="")
{
$query="Insert into $table_name (email) values ('$email')";
$result=&$conn->Execute($query); //Uses adodb db library
print $email."<br>";
}
}
Here's the CF code I have so far
CF
<cffile
action = "read"
file = "C:\inetpub\wwwroot\intranet\master_email.txt"
variable = "EmailList" >
I'm new at this so any help would be greatly appreciated.
Luis R. Lebron
Project Manager
Sigmatech, Inc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm