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" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
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







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

Reply via email to