Can I use PHP to create a script that takes a CSV file and writes it to a mySQL database?
Also, wha'ts the limit to the DB size? Cos i have about 1800 records to add in.
Thanks!
Printable View
Can I use PHP to create a script that takes a CSV file and writes it to a mySQL database?
Also, wha'ts the limit to the DB size? Cos i have about 1800 records to add in.
Thanks!
3398 per table
3398 per table? a DB can hold 4 TB of info. so I don't think you are limited to a certain size in a table. and 1800 records is small.
also Gimlin I had 20,000 rows in one table.
Ooops I ment 3398 columns
ahh hehe that makes sense.
ok, thanks for the size of DB thing :D
so, is it possible to read in a CSV file and convert it to mySQL using PHP or any other means? thanks! :D
you can read any type of file and parse it through php and insert it into the database.
got any sample code to share? :D a bit new at this :D
suppose my file is :
"data1", "data2", "data3"
"data1", "data2", "data3"
where each field is within " " and seperated by commas and each new line is a new record.
How do i use the string functions to extract out each bit of data from within the " "?
thanks!
thanks! but if i useQuote:
explode (',',$fileread[$i]);
then if my data has a comma in it, it will also be stripped into an array. Cos in one of the fields, there are commas within the data block
Thanks!
then I would change the comma to something else. if you are using a CSV then all commas are delimiters and they show the seperation between fields. that's what CSV means "Comma Separated Values text file format (ASCII)"
if you have commas in with your data then you better switch it or is is not a CSV.
just split each line by
", "
then, hopefully you will not get any problems with that :o