Welcome Guest, Not a member yet? Register   Sign In
CSV to mysql databse!!!
#1

[eluser]Rabbi[/eluser]
I want to know, is there any method or way to convert CSV file to mysql with CodeIgniter?

I know it with phpMyAdmin. But i want to know with CodeIgniter, is it possible?

Please tell me.
#2

[eluser]Developer13[/eluser]
Yes of course it's possible.
#3

[eluser]EEssam[/eluser]
I think you should code the good part of that yourself, however it's pretty easy.
#4

[eluser]Randy Casburn[/eluser]
It is a MySQL SQL statementLOAD DATA INFILE

Very simple.

Randy
#5

[eluser]Rabbi[/eluser]
Ok thanks everybody.
Can you show me, how to do it in CodeIgniter?
#6

[eluser]Pascal Kriete[/eluser]
Here's a quote from what Randy posted:
Quote:LOAD DATA INFILE 'data.txt' INTO TABLE tbl_name
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n';

Then check out this user guide page and put 2 and 2 together.
#7

[eluser]Rabbi[/eluser]
Thanks got it now.
#8

[eluser]marcoss[/eluser]
WTF! Use MySQL to import a CSV? how would you debug that? validate data? split large files? etc, etc, etc.

Data should be validated before being used in a database, use one of the many CSV parsers available and prepare your data first.

I would recommend http://code.google.com/p/parsecsv-for-php/, does what it says and supports PHP 4/5.




Theme © iAndrew 2016 - Forum software by © MyBB