Page 1 of 1

Trying To Group similar CSV Entries

Posted: Sat Jan 16, 2010 9:56 pm
by Monotoko
Hello,

At the moment, i am showing a simple table with the CSV table in it, using this code (the table is defined earlier):

Code: Select all

 
<?php
$row = 1;
$handle = fopen("../inc/searches.csv", "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { 
    $num = count($data); // the number of columns
    $row++;
    echo "<tr>";
    for ($c=0; $c < $num; $c++) {
        echo "<td>".$data[$c] . "</td>\n";
    }
    echo "</tr>";
}
fclose($handle);
?>


What i need to do, before this... is search through, and count how many things have the same "Title" field, can anyone help me achieve this?

Re: Trying To Group similar CSV Entries

Posted: Sun Jan 17, 2010 9:04 am
by josh
$this->count[ $title ]++;