Reply to file/array manipulation

Your name:

Reply:


Posted by Mignon Hunter on 03/14/05 22:00

Hello

I'm trying to manipulate a text(.csv) file using php. I've read the file and can print each line,
but I need to write where column A is missing

ColumnA ColumnB

R ABC company
ABC company
ABC company
ABC company
O XYZ company
XYZ company
XYZ company
XYZ company

What I need to do is write a while loop (I think) to interate through the lines and populate ColumnA
while ColumnB equals $var (ABC company, XYZ company), so that I end up with:

ColumnA ColumnB

R ABC company
R ABC company
R ABC company
R ABC company
O XYZ company
O XYZ company
O XYZ company
O XYZ company

Is this possible. What I've got so far to print out the file:

$lines = file('test2.csv');

// Loop through our array, and show line and numbers too.
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . $line . "<br />\n";
}


Thanks in advance

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация