Re: Array within array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I would do something like

$fp = fopen($file_location, 'r');
while (!$fp) {
$csv_line = fgetcsv($fp);
//insert line into database here after appropriate validation and cleaning
}

On Fri, 30 Sep 2005 06:29:11 -0400, Chris <chris@xxxxxxxxxxxx> wrote:

Greetings PHP community,

I have a CSV text file which I need to use to update existing DB
records.

So I have the following :

$array_file = file("path/to/file");

file() creates an array comprising each line of the file, but if each
line contains 20 or so CS values, how do I go about reading each line
and updating the db.

Pseudo code :
=====
$array_file = file("path/to/file");
while (explode(',',$file_array))
{
  do update on db for each line of array
}
=====

Any pointers ?

--
Chris Blake
Cell: 082 775 1492
Work: +27 11 880 2825
Fax : +27 11 782 0841
Mail: chris@xxxxxxxxxxxx

Immortality -- a fate worse than death. -- Edgar A. Shoaff



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux