Jump to content

CSV files


Jimbo_17

Recommended Posts

I've done this before... fopen() fgets(), then explode() by comma.

No sorting, no joining, no relations, no indexing, and rudimentary searching. Depending on the size of the file, it might even be snail slow.

Better idea: Write a converter to put your CSV into a mysql database. I have several of these running through cron. They download the CSV file via FTP, parse it, and dump it into a mysql database -- every day. MySQL loves doing advanced searches and sorts lightning fast.
Link to comment
Share on other sites

Instead of
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]fopen() fgets(), then explode() by comma.[/quote]
you really should look at the [a href=\"http://www.php.net/fgetcsv\" target=\"_blank\"]fgetcsv()[/a] function, since it knows how to handle commas inside a quoted string.

Ken
Link to comment
Share on other sites

Might look at these...

[a href=\"http://www.c-worker.ch/txtdbapi/index_eng.php\" target=\"_blank\"]http://www.c-worker.ch/txtdbapi/index_eng.php[/a]

[a href=\"http://ffdb-php.cvs.sourceforge.net/ffdb-php/README?revision=1.6&view=markup\" target=\"_blank\"]http://ffdb-php.cvs.sourceforge.net/ffdb-p...1.6&view=markup[/a]



Lite...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.