
Hello Thea; i beleive your interest is in this part /**** elseif($arraysize=12) { echo "YIPEEEEE"; $import="INSERT into $table values('$data[0]', '$data[1]' ,'$data[2]','$data[3]','$data[ 4]','$data[5]', '$data[6]','$data[7]', '$data[8]','$data[9]','$data[10]','$data[11]')"; } ****/ Thea Ashford K. 2009/9/24 Nicholas Loki <lokimwenga@yahoo.com>
Hi Skunks, I think what Thea is looking for is a solution that will allow him to insert as many column items into a database table as there are tokens in the the $data array, which I assume is a line entry in a particular csv/text file. I would suggest that you use the $data array length as your limit. And concatenate a string representing your INSERT statement. Also it might be prudent to create your table before hand using the $data array length to determine the number of columns needed. Hope this helps some.
KR, Loki
"Excellent people exceed expectations".
------------------------------ *From:* Frankline Chitwa <frank.chitwa@gmail.com> *To:* Skunkworks Forum <skunkworks@lists.my.co.ke> *Sent:* Thursday, September 24, 2009 10:54:46 AM *Subject:* Re: [Skunkworks] Iterate this for infinity
just as you have done it. You have the $data variable, so use it as you had used it b4
On Thu, Sep 24, 2009 at 10:46 AM, thea maina <theamaina@gmail.com> wrote:
In your while loops, How is the $data from the CSV file been INSERTed INTO a new TABLE COLUNM?
On Thu, Sep 24, 2009 at 10:30 AM, Frankline Chitwa < frank.chitwa@gmail.com> wrote:
Maybe he wants to break the loop if he encounters a certain condition, and not necessarily go to the end of his data. try $loop = true; while($loop){ $data = fgetcsv($handle, 1000, ","); if($arraysize......................
//and to break the loop if(condition){ $loop = false; } }
Be careful with this thoough. Make sure your condition always happens before the end of your data.
On Thu, Sep 24, 2009 at 9:21 AM, <ashok+skunkworks@parliaments.info<ashok%2Bskunkworks@parliaments.info>
wrote:
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
-- www.dealcent.com - Your electronics shop www.golavish.com - The travel and leisure www.raccuddasys.com - code Development issues
_______________________________________________ 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
-- --------------------------------------------------------------------- Thea Maina Nairobi Kenya http://www.mafans.com skype: thea.mnairobi
_______________________________________________ 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
-- www.dealcent.com - Your electronics shop www.golavish.com - The travel and leisure www.raccuddasys.com - code Development issues
_______________________________________________ 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