CSV Import Question

From: Date: Tue, 18 Nov 2003 04:34:37 +0000
Subject: CSV Import Question
Groups: php.db 
Request: Send a blank email to php-db+get-31603@lists.php.net to get a copy of this message
Hi there everyone, I have a 2 Column CSV file, and i'm trying to import it into the DB via a form, I have it importing fine with the first field (Called EMail) but I cannot get it to import the second column correctly (Called name). I know it's going to be something so obvious i'll pass out, but does anyone have any ideas? Here's the code: $row = 1; $handle = fopen ("$userfile","r"); while ($data = fgetcsv ($handle, 250, "$delim")) { $num = count ($data); $row++; for ($c=0; $c < $num; $c++) { mysql_query ("INSERT INTO emaillist (EMail,name) VALUES ('$data[$c]','$data[$c]') When I import, it puts all data in the EMail field, even the name field. Any help would be appreciated beyond belief as this is annoying the crapola out of me :-) Chris

« previous php.db (#31603) next »