foreach() iterates across an array. For each pass, it assigns the found value to a variable. You're not using that variable. Why not? Perhaps you mean
<?php
$filename = "mod.csv";
$id = fopen($filename, "r");
while ($data = fgetcsv($id, filesize($filename),",")){
foreach ($data as $row)
echo "$row";
echo "\n";
}
?>
Or, using your original model of referencing the $data array directly, you don't need the foreach.
<?php
$filename = "mod.csv";
$id = fopen($filename, "r");
while ($data = fgetcsv($id, filesize($filename),","))
echo "$data[0],$data[1],$data[2]\n";
?>