PHP Classes

File: test.csv.class.php

Recommend this page to a friend!
  Classes of Mike Leigh   phpCSV   test.csv.class.php   Download  
File: test.csv.class.php
Role: Example script
Content type: text/plain
Description: Example script
Class: phpCSV
Read data from CSV files into arrays
Author: By
Last change: See the CHANGELOG file for the summary of changes to this version
Date: 17 years ago
Size: 1,734 bytes
 

Contents

Class file image Download
<?php
#===========================================================================
#= Script : phpCSV
#= File : csv.class.php
#= Version: 0.3
#= Author : Mike Leigh
#= Email : mike@mikeleigh.com
#= Website: http://www.mikeleigh.com/scripts/phpcsv
#= Support: http://www.mikeleigh.com/forum
#===========================================================================
#= Copyright (c) 2006 Mike Leigh
#= You are free to use and modify this script as long as this header
#= section stays intact
#=
#= This file is part of phpCSV.
#=
#= phpCSV is free software; you can redistribute it and/or modify
#= it under the terms of the GNU General Public License as published by
#= the Free Software Foundation; either version 2 of the License, or
#= (at your option) any later version.
#=
#= phpCSV is distributed in the hope that it will be useful,
#= but WITHOUT ANY WARRANTY; without even the implied warranty of
#= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#= GNU General Public License for more details.
#=
#= You should have received a copy of the GNU General Public License
#= along with DownloadCounter; if not, write to the Free Software
#= Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#===========================================================================
include('./csv.class.php');

$csv = new phpCSV();
$csv->open('test.csv.class.csv', 'r');
$csv->setFirstRowContainsColumnHeadings(true);

while(!
$csv->getEOF()) {
   
$result = $csv->fetch();
    if(
$result <> false) {
        foreach(
$csv->attributes['csv']['result']['data'] as $row => $column) {
            print
$csv->getValue($row, 0)." ".$csv->getValue($row, 1);
        }
    }
}
$csv->close();
?>