| | |
parsing a csv file
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2008
Posts: 35
Reputation:
Solved Threads: 0
hi, im not such a php expert and i want to parse a csv file located at http://www.totalbeauty.com/resource/lists. does anyone know how i can do this, what to watch out for, the best way to do this and just general tips for parsing files.
thanks..
thanks..
http://php.net/fgetcsv There's a builtin PHP function
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
Join Date: Apr 2008
Posts: 35
Reputation:
Solved Threads: 0
does anyone know how to get the max lenght of any line in the file? the fgetcsv() requires a lenght argument that should ne greater that the longest line in the file.
Unless you're using PHP4 you don't need it, if the PHP document shows an argument in [] then it is optional
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
[quote-php 5.04 manual]fgetcsv() parses the line it reads for fields in CSV format and returns an array containing the fields read.
. . . . .
length
Must be greater than the longest line (in characters) to be found in the CSV file (allowing for trailing line-end characters). It became optional in PHP 5. Omitting this parameter (or setting it to 0 in PHP 5.0.4 and later) the maximum line length is not limited, which is slightly slower.
. . . . .[/quote] no longer really necessary, if your host is running php5
its not a very well formed file, only 3 lines, a list of brandnames, semi-colon separated no quotes
. . . . .
length
Must be greater than the longest line (in characters) to be found in the CSV file (allowing for trailing line-end characters). It became optional in PHP 5. Omitting this parameter (or setting it to 0 in PHP 5.0.4 and later) the maximum line length is not limited, which is slightly slower.
. . . . .[/quote] no longer really necessary, if your host is running php5
its not a very well formed file, only 3 lines, a list of brandnames, semi-colon separated no quotes
Last edited by almostbob; Jul 21st, 2009 at 7:49 pm.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Similar Threads
- Parsing a CSV file separated by semicolons. (C++)
- having trouble parsing more than one html file into a csv file (Python)
- Parsing a csv file in C (C)
- Parsing CSV file in partcular format (Java)
- parsing csv file (PHP)
Other Threads in the PHP Forum
- Previous Thread: http://www.xyz.com/?id=1 style URL
- Next Thread: upload file thru php
| Thread Tools | Search this Thread |
ajax apache api array beginner binary body broken cakephp checkbox class cms code cron curl database date date/time display dynamic echo email error file files folder form forms function functions gc_maxlifetime global google host href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail memmory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation oop parameter parsing paypal pdf php problem query radio random recourse recursion regex registrationform remote script search seo server sessions sms soap source space sql static syntax system table tutorial update upload url validator variable video web webdesign wordpress xml youtube






