Re: CSV. Parsing a defined row?

From: Date: Thu, 06 Jun 2002 16:22:59 +0000
Subject: Re: CSV. Parsing a defined row?
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-14107@lists.php.net to get a copy of this message
try a combination of fgets and explode, like this $f = fopen($fn, "r"); while($row = fgets($f)) { $cols = explode(",",$row); if ((int)$cols[0] == (int)$id) break; unset($cols); } if ($cols) { echo $cols[0]; echo $cols[1]; echo $cols[2]; } guess should do it; hth ilker "Frankthiel" <thier6@gmx.de> wrote in message news:5.1.0.14.0.20020605153757.029110f8@pop.gmx.net... Hello, i couldn´t find an answer in the NewsArchive. How can i parse a CSV file, and show a defined row taken from an url. I have got this link www.something.com/something.php?id=234 the CSV example: id,article,category 233,art1,cat1 234,art2,cat2 235,art3,cat3 I do know how i can parse a whole file with fgetcsv, but not how to parse an explicit line. THX for help. Frank Thiel

« previous php.windows (#14107) next »