I've copied this php:
<?Php
echo "<html><body><table border=1>";
$f = fopen("datos.csv", "r");
$fr = fread($f, filesize("datos.csv"));
fclose($f);
$lines = array();
$lines = explode("\r\n",$fr); // IMPORTANT the delimiter here just the "new line" \r\n, use what u need instead of...
for($i=0;$i<count($lines);$i++) {
echo "<tr>";
$cells = array();
$cells = explode(",",$lines[$i]); // use the cell/row delimiter what u need!
for($k=0;$k<count($cells);$k++) {
echo "<td>".$cells[$k]."</td>";
}
// for k end
echo "</tr>";
}
// for i end
echo "</table></body></html>";
?>
This code generates the html table. I have a csv with one column with diferent values separated with comma, and I want only some values. The question is the loop with the variable $k to catch only value2, value4, value7 ,... I appreciate some help, I'm learning php but I start in advanced mode :-( and I search this site but don't find it.
explode()to break up a CSV file, it won't handle quotes and escaped characters correctly. Usefgetcsv()instead.