You can read the whole file (file_get_contents) and count the number
of "\n" in it, or read it line by line with fgets and store the lines
in an array, and then the number of lines is the count() of the array,
and you can use that array to store it in the database.


On Wed, Jun 24, 2009 at 9:05 AM, Alain Roger<> wrote:
> Hi,
> i would like to import the content of a CSV file into my database.
> but in order to show a progress bar to user  (to let him know that process
> is still working on) i would like to determine before to start, how many
> records / lines are in the CSV file.
> is there a way to do that ?
> thanks a lot.
> --
> Alain
> -----------------------------------------------------------
> Windows XP x64 SP2 / Fedora 10 KDE 4.2
> PostgreSQL 8.3.5 / MS SQL server 2005
> Apache 2.2.10
> PHP 5.2.6
> C# 2005-2008

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to