PHP show row from CSV based on value

Hi all,

I have a datafeed (csv) with lots of rows and columns. Now I want to only show rows that have a certain number. In short I have this csv file:

[table]
[tr]
[td]name[/td][td]price[/td][td]ean[/td][td]spec[/td]
[/tr]
[tr]
[td]name 1[/td][td]12[/td][td]80451547[/td][td]yes[/td]
[/tr]
[tr]
[td]name 2[/td][td]132[/td][td]865645645[/td][td]yes[/td]
[/tr]
[tr]
[td]name 3[/td][td]142[/td][td]8657547[/td][td]yes[/td]
[/tr]
[tr]
[td]name 4[/td][td]172[/td][td]84574547[/td][td]yes[/td]
[/tr]
[/table]

Now I want to show only the row where EAN = 865645645

Is this possible? This is what I have so far:

[php]

<?php fgetcsv_PHP(); function fgetcsv_PHP() { if (($handle = fopen("bcc.csv", "r")) !== FALSE) { $length = 1000; $delimiter = ";"; echo "\n"; while ( ( $data = fgetcsv( $handle, $length, $delimiter ) ) !== FALSE ) { $num = count($data); echo "\n"; for ($c=0; $c < $num; $c++) { echo "\n"; } echo "\n"; } echo "
".$data[$c]."
"; fclose($handle); } } ?>

[/php]

Thanks in advance

Sponsor our Newsletter | Privacy Policy | Terms of Service