Re: [PHP] fgets function for very large files

2009-05-25 Thread shahrzad khorrami
in the following loop: $row = 1; while (($line = fgets($handle, 1024)) !== FALSE ) { $line = str_replace(SEPARATOR, ",", $line); $data = explode(",", $line); $row++; } How put 1000 by 1000 lines of csv file to new ones? and you know I think this works slow

Re: [PHP] fgets function for very large files

2009-05-24 Thread Lars Torben Wilson
2009/5/24 shahrzad khorrami : > :-o > I want to divide this large csv file with programming to small one! If you're on *nix: % man split Regards, Torben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] fgets function for very large files

2009-05-24 Thread Nathan Rixham
shahrzad khorrami wrote: :-o I want to divide this large csv file with programming to small one! 1: http://php.net/fgetcsv 2: if( ($row % 1) == 0 ) { 3: http://php.net/fputcsv csv split in to multiple csv's of 10k rows each -- PHP General Mailing List (http://www.php.net/) To unsubscribe

Re: [PHP] fgets function for very large files

2009-05-24 Thread shahrzad khorrami
:-o I want to divide this large csv file with programming to small one!

Re: [PHP] fgets function for very large files

2009-05-24 Thread kranthi
1. open that in a text editor 2. copy a few lines 3. create a new text file 4. paste the copied lines 5. save with the extension .csv but i doubt this process works i faced exactly same problem few months back and i found http://www.tech-recipes.com/rx/2345/import_csv_file_directly_into_mysql/ to

Re: [PHP] fgets function for very large files

2009-05-24 Thread shahrzad khorrami
How to divide a large csv file to small ones? Thanks, Shahrzad

Re: [PHP] fgets function for very large files

2009-05-23 Thread kranthi
i accept the fact that PMA is full of security holes, and it should not be used on production server. but it does not mean that we can never use it on a development server probably you may have a bit of trouble while moving from development server to production server. but u can always export y

Re: [PHP] fgets function for very large files

2009-05-23 Thread Ashley Sheridan
On Sat, 2009-05-23 at 02:59 -0400, Eddie Drapkin wrote: > On Sat, May 23, 2009 at 2:58 AM, Ashley Sheridan > wrote: > > > > > If it's a CSV, I'd recommend using phpMyAdmin directly to import it into > > the database, assuming you are using a MySQL database that is. It's > > using tried and tested

Re: [PHP] fgets function for very large files

2009-05-23 Thread Michael A. Peters
shahrzad khorrami wrote: one thing! I need four fields of 7 fields in each line, in my code from original csv file first four of fields choose(mappping these fields with columns of table in db) for example: a line in csv file: "a","b","c","d","e","f","g" in table of database 4 column : name,ex

Re: [PHP] fgets function for very large files

2009-05-23 Thread shahrzad khorrami
one thing! I need four fields of 7 fields in each line, in my code from original csv file first four of fields choose(mappping these fields with columns of table in db) for example: a line in csv file: "a","b","c","d","e","f","g" in table of database 4 column : name,ext,tel,date that 4 field of

Re: [PHP] fgets function for very large files

2009-05-23 Thread shahrzad khorrami
Thanks for repply :) It must be automatically, it means that there is a form that an operator browse a csv with large size(more than 2-3 GB) and in next step(page) first 1000 line insert into db then by clicking on next button, next 1000 line operator don't know any thing about phpmyadmin and

Re: [PHP] fgets function for very large files

2009-05-23 Thread Eddie Drapkin
On Sat, May 23, 2009 at 2:58 AM, Ashley Sheridan wrote: > > If it's a CSV, I'd recommend using phpMyAdmin directly to import it into > the database, assuming you are using a MySQL database that is. It's > using tried and tested code for large files like that. > > Tried and true to be what, exactly

Re: [PHP] fgets function for very large files

2009-05-22 Thread Ashley Sheridan
On Sat, 2009-05-23 at 10:41 +0430, shahrzad khorrami wrote: > hi all, > > I have a csv file with more than 100,000 lines. I want to insert each line > as a record in a > database. but for the reason of very number of lines, > I put a button with caption Next, when we click on it, 1000 line will >

[PHP] fgets function for very large files

2009-05-22 Thread shahrzad khorrami
hi all, I have a csv file with more than 100,000 lines. I want to insert each line as a record in a database. but for the reason of very number of lines, I put a button with caption Next, when we click on it, 1000 line will insert into db and then again click next button and insert next 1000 line