Hi from your implementation, you are reading the file upto 1000 lines since fgetcsv takes the second parameter as the line numbers to read, if you want to read the entire file then have the second parameter as 0, it will process the entire file.

I refuse to believe that the file is of infinite length : )

I am also seeing a problem with the inserts, if the lines of the csv file are of variable columns then you might have to explicitly define the columns to be inserted in the table.

e.g.

if your table has 4 columns and the csv has 3 columns then the import statement ends looking like this:

insert into table values(1,2,3);

this will throw a mysql error ( ERROR 1136 (21S01): Column count doesn't match value count)

or am i missing something?

Regards
./chris




On Thu, Sep 24, 2009 at 12:39 PM, wesley kirinya <kiriinya2000@yahoo.com> wrote:
Good question Ashok.
 
@ Thea, why infinity?

 


--- On Thu, 9/24/09, ashok+skunkworks@parliaments.info <ashok+skunkworks@parliaments.info> wrote:

From: ashok+skunkworks@parliaments.info <ashok+skunkworks@parliaments.info>
Subject: Re: [Skunkworks] Iterate this for infinity
To: "Skunkworks Forum" <skunkworks@lists.my.co.ke>
Date: Thursday, September 24, 2009, 9:21 AM


On Thu, Sep 24, 2009 at 9:14 AM, thea maina  wrote:
> Iterate this for infinity. - Hi guys, i hit a mind lock.. How can i iterate
> this for infinity.
> thanks
> ----------------------------------------------------------------
>
> while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
>      {

maybe this ?

while (TRUE) {
   while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
  }
}

but are you dealing with infinite data ?
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science:  http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi:     http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general


_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science:  http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi:     http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general