Forums
This topic is locked
Import CSV File Data into MySQL
Posted 21 Feb 2008 13:46:58
1
has voted
21 Feb 2008 13:46:58 Nkosinathi Khoza posted:
Hi AllPlease help guys i'm pulling my hair here. I need to import data from CSV file that is uploaded at runtime into a MySQL Database Table below is the syntax below it returns neither an error nor the warning.
$sql=" LOAD DATA LOCAL INFILE '".@mysql_escape_string($this->file_name)"'
INTO TABLE `DistributionGroup`
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(MobileNumber, FirstName) ";
Replies
Replied 21 Feb 2008 13:51:01
21 Feb 2008 13:51:01 Nkosinathi Khoza replied:
Here is the continuation if needed
$res = @mysql_query($sql);
$res = @mysql_query($sql);
Replied 22 Feb 2008 10:22:43
22 Feb 2008 10:22:43 Alan C replied:
HI,
I'm not familiar with that, but a way of tackling it would be to try using phpmyadmin, going into the tab that lets you run queries, then you can paste in the appropriate query - replace the bits that you need to calculate, then run it and see what happens, that's how I usually find the faults in my stuff
hope that helps
Oh, I had another thought - file path - I just did some work that was a real pig because of file paths, some needed to be the full path on the server, like /home/ . . . and others needed to be from the site root, once I got those sorted out things went well.
Edited by - sitemaster on 22 Feb 2008 10:24:22
I'm not familiar with that, but a way of tackling it would be to try using phpmyadmin, going into the tab that lets you run queries, then you can paste in the appropriate query - replace the bits that you need to calculate, then run it and see what happens, that's how I usually find the faults in my stuff
hope that helps
Oh, I had another thought - file path - I just did some work that was a real pig because of file paths, some needed to be the full path on the server, like /home/ . . . and others needed to be from the site root, once I got those sorted out things went well.
Edited by - sitemaster on 22 Feb 2008 10:24:22
Replied 25 Feb 2008 13:26:39
25 Feb 2008 13:26:39 Nkosinathi Khoza replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
HI,
I'm not familiar with that, but a way of tackling it would be to try using phpmyadmin, going into the tab that lets you run queries, then you can paste in the appropriate query - replace the bits that you need to calculate, then run it and see what happens, that's how I usually find the faults in my stuff
hope that helps
Oh, I had another thought - file path - I just did some work that was a real pig because of file paths, some needed to be the full path on the server, like /home/ . . . and others needed to be from the site root, once I got those sorted out things went well.
Edited by - sitemaster on 22 Feb 2008 10:24:22
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I have tried this out with no success
HI,
I'm not familiar with that, but a way of tackling it would be to try using phpmyadmin, going into the tab that lets you run queries, then you can paste in the appropriate query - replace the bits that you need to calculate, then run it and see what happens, that's how I usually find the faults in my stuff
hope that helps
Oh, I had another thought - file path - I just did some work that was a real pig because of file paths, some needed to be the full path on the server, like /home/ . . . and others needed to be from the site root, once I got those sorted out things went well.
Edited by - sitemaster on 22 Feb 2008 10:24:22
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I have tried this out with no success