Location: PHPKode > scripts > csv2table > csv2table/example.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
       <title>Example</title>
</head>

<body>
<center><h2>csv2table demo.</h2></center>
<?
include "csv2table.inc";

$cs = new csv2table();

$csvfile="test.csv";
$title="CSV Table Demo";

//Listing all names
echo "<br><center><h4>Listing all names</h4></center>";
//$cs->set_tablewidth("60%");
$cs->showtable($csvfile,$title);

//Listing all names where age greater than 35
echo "<br><hr><br><br><center><h4>Listing all names where age greater than 35</h4></center>";
$fields = "1,2,3";
$filter[2] = ">,35";
$cs->set_tablewidth("30%");
$cs->showtable($csvfile,$title,$fields,$filter);

//Listing all names where age greater than 35 and city is London
echo "<br><hr><br><br><center><h4>Listing all names where age greater than 35 and city is London</h4></center>";
$fields = "1,2,3";
$filter[2] = ">,35";
$filter[3] = "=,London";
$cs->set_tablewidth("30%");
$cs->showtable($csvfile,$title,$fields,$filter);

?>
</body>
</html>
Return current item: csv2table