Tamara, THANK YOU! Switching the id field to last worked. But why? I'm good to go now, but just curious. Sincerely, Brad <?php var_dump($_FILES); //db connection require 'dbConnect.php'; //session file require_once('../auth.php'); function uploadList(){ $target_path = "/home/nyctelecomm.com/www/mail/upload/"; //$_FILE function, grab files $inFile = $_FILES["file"]; //Get file name $filename = $inFile["name"]; //strip the file extension $filename = preg_replace('/\.[^.]+$/','',$filename); var_dump($_FILES); //grab sessionID which is memberID $memberID = $_SESSION["SESS_MEMBER_ID"]; //identify cvs, tested with MS excel in csv format if ($inFile["type"] == "application/octet-stream") { if ($inFile["error"] > 0) { echo "Return Code: " . $inFile['error'] . "<br />"; } else { dbConnect(); //move_uploaded_file($_FILES["file"],$target_path); //chmod ($filename['file'], 0777); mysql_select_db('mailList') or die(mysql_error()); //assign temporary name to variable //for insert since tmp_file is the real file $tmp_name = $inFile["tmp_name"]; $presql = "CREATE TABLE IF NOT EXISTS `{$memberID}` (id MEDIUMINT AUTO_INCREMENT PRIMARY KEY UNIQUE)"; $midsql = "ALTER TABLE `{$memberID}` ADD `{$filename}` VARCHAR(60) FIRST"; $sql = <<<EOF LOAD DATA LOCAL INFILE '{$tmp_name}' INTO TABLE `{$memberID}` FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\\'' LINES TERMINATED BY "\\r\\n IGNORE 1 LINES ($filename)" EOF; var_dump($sql); echo '$sql'; mysql_query($presql) or die(mysql_error()); mysql_query($midsql) or die(mysql_error()); mysql_query($sql) or die(mysql_error()); var_dump($sql); echo '$sql'; if(mysql_error()) { echo(mysql_error()); } else { print('Import of campaign emails sucessfull into mysql table.'); } } } else { print('Invalid file type. Please make sure it is a text file.'); } } //var_dump($_FILES); uploadList(); ?> *************************************output********************************* ****** array(1) { ["file"]=> array(5) { ["name"]=> string(13) "testBook1.csv" ["type"]=> string(24) "application/octet-stream" ["tmp_name"]=> string(14) "/tmp/phpZllgLU" ["error"]=> int(0) ["size"]=> int(102) } } array(1) { ["file"]=> array(5) { ["name"]=> string(13) "testBook1.csv" ["type"]=> string(24) "application/octet-stream" ["tmp_name"]=> string(14) "/tmp/phpZllgLU" ["error"]=> int(0) ["size"]=> int(102) } } string(178) " LOAD DATA LOCAL INFILE '/tmp/phpZllgLU' INTO TABLE `3` FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\'' LINES TERMINATED BY "\r\n IGNORE 1 LINES (testBook1)"" $sqlstring(178) " LOAD DATA LOCAL INFILE '/tmp/phpZllgLU' INTO TABLE `3` FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\'' LINES TERMINATED BY "\r\n IGNORE 1 LINES (testBook1)"" $sqlImport of campaign emails sucessfull into mysql table. ***********************************database************************ mysql> show tables; +--------------------+ | Tables_in_mailList | +--------------------+ | 3 | +--------------------+ 1 row in set (0.00 sec) mysql> select * from `3`; +--------------------------------------------------------------+----+ | testBook1 | id | +--------------------------------------------------------------+----+ | brads@xxxxxxxxx brads@xxxxxxxxx brads@xxxxxxxxx brads@yah | 1 | +--------------------------------------------------------------+----+ 1 row in set (0.00 sec) -----Original Message----- From: Tamara Temple [mailto:tamouse@xxxxxxxxx] Sent: Friday, July 27, 2012 12:50 PM To: Brad Subject: Re: Re: No data? try this: http://23.20.205.51/loadtablefromcsv/ See the source at http://23.20.205.51/loadtablefromcsv/index.phps -- Tamara Temple aka tamouse__ Email: tamouse@xxxxxxxxx Web: http://www.tamaratemple.com/ "May you never see a stranger's face in the mirror" -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php