Re: CSV file
| From: | Jonathan Tapicer | Date: | Wed, 24 Jun 2009 19:00:13 +0000 |
| Subject: | Re: CSV file | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294541@lists.php.net to get a copy of this message | ||
To do the line count first, you have to read the whole file, how would
you do it?
On Wed, Jun 24, 2009 at 3:00 PM, Richard Heyes<richard@php.net> wrote:
> Hi,
>
>> If you want to know how many lines there are *before* inserting to the
>> database, you can't count "as you go", you have to either read the
>> file twice or read it once, store it memory in a variable and then
>> insert in the database.
>
> Sure you can, simply do the line count first, then the insert. If it's
> a big file it will still be quicker than reading the whole thing into
> memory.
>
> --
> Richard Heyes
> HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
> PHP mail: RMail (www.phpguru.org/rmail)
> PHP datagrid: RGrid (www.phpguru.org/rgrid)
> PHP Template: RTemplate (www.phpguru.org/rtemplate)
> PHP SMTP: http://www.phpguru.org/smtp
>