Richard Bryce
|
Posted: 04/15/2003, 6:15 PM |
|
Hi All,
A pretty basic PHP question....
I pulled the following code down off www.php.net. When I put this into a
file (named test1.php) and try to run it I am getting some CGI error. Can
anyone helpme on what else I need to do.
Once I get this working I am going to modify the script so that the contents
of the CSV file are loaded into mysql for viewing
With thanks
Richard Bryce
<?php
$row = 1;
$handle = fopen ("test.csv","r");
while ($data = fgetcsv ($handle, 1000, ",")) {
$num = count ($data);
print "<p> $num fields in line $row: <br>\n";
$row++;
for ($c=0; $c < $num; $c++) {
print $data[$c] . "<br>\n";
}
}
fclose ($handle);
?>
|
|
|
Trisiana Tana
|
Posted: 05/08/2003, 2:35 AM |
|
you should check your URL address:
should be complete like this: http://servername/test1.php
"Richard Bryce" <richard@northshoreit.com.au> wrote in message
news:b7iare$ss0$1@news.codecharge.com...
> Hi All,
> A pretty basic PHP question....
>
> I pulled the following code down off www.php.net. When I put this into a
> file (named test1.php) and try to run it I am getting some CGI error.
Can
> anyone helpme on what else I need to do.
>
> Once I get this working I am going to modify the script so that the
contents
> of the CSV file are loaded into mysql for viewing
>
>
> With thanks
>
>
>
>
> Richard Bryce
>
>
>
>
>
> <?php
> $row = 1;
> $handle = fopen ("test.csv","r");
> while ($data = fgetcsv ($handle, 1000, ",")) {
> $num = count ($data);
> print "<p> $num fields in line $row: <br>\n";
> $row++;
> for ($c=0; $c < $num; $c++) {
> print $data[$c] . "<br>\n";
> }
> }
> fclose ($handle);
> ?>
>
>
>
>
>
>
|
|
|
|