Trying To Group similar CSV Entries

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Monotoko
Forum Commoner
Posts: 64
Joined: Fri Oct 26, 2007 4:24 pm

Trying To Group similar CSV Entries

Post 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?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Trying To Group similar CSV Entries

Post by josh »

$this->count[ $title ]++;
Post Reply