|
-
Aug 14th, 2002, 06:38 AM
#1
Thread Starter
Member
PHP, mySQL, CSV
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!
-
Aug 14th, 2002, 07:14 AM
#2
Fanatic Member
-
Aug 14th, 2002, 09:19 AM
#3
Lively Member
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.
Just Imagine what you can do with the power of php.
257 Tutorials and counting.
529 Snippets and growing.
Add yours today @
SnippetLibrary.com
-
Aug 14th, 2002, 10:39 AM
#4
Fanatic Member
Ooops I ment 3398 columns
-
Aug 14th, 2002, 11:28 AM
#5
Lively Member
ahh hehe that makes sense.
Just Imagine what you can do with the power of php.
257 Tutorials and counting.
529 Snippets and growing.
Add yours today @
SnippetLibrary.com
-
Aug 14th, 2002, 05:15 PM
#6
Thread Starter
Member
ok, thanks for the size of DB thing 
so, is it possible to read in a CSV file and convert it to mySQL using PHP or any other means? thanks!
-
Aug 14th, 2002, 05:31 PM
#7
Lively Member
you can read any type of file and parse it through php and insert it into the database.
Just Imagine what you can do with the power of php.
257 Tutorials and counting.
529 Snippets and growing.
Add yours today @
SnippetLibrary.com
-
Aug 15th, 2002, 05:41 AM
#8
Thread Starter
Member
got any sample code to share? a bit new at this 
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!
-
Aug 15th, 2002, 07:19 AM
#9
Lively Member
Just Imagine what you can do with the power of php.
257 Tutorials and counting.
529 Snippets and growing.
Add yours today @
SnippetLibrary.com
-
Aug 15th, 2002, 07:27 AM
#10
Thread Starter
Member
thanks! but if i use
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!
-
Aug 15th, 2002, 07:50 AM
#11
Lively Member
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 Imagine what you can do with the power of php.
257 Tutorials and counting.
529 Snippets and growing.
Add yours today @
SnippetLibrary.com
-
Aug 18th, 2002, 12:07 AM
#12
Conquistador
just split each line by
", "
then, hopefully you will not get any problems with that
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|