Jump to content


Photo

fgetcsv


  • Please log in to reply
1 reply to this topic

#1 mkklepper

mkklepper
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 18 October 2006 - 01:30 AM

I have a script that writes link info to a text file, this script reads and displays the information. Everything works bit I get this error  msg Notice:Undefined index: 1 in c:\inetpub\wwwroot\file\path.php on line 44
$display = "file\\path.txt";

if( is_file($file($display) ) {
$fp = @fopen("$display", 'rb');
    while( $line = @fgetcsv($fp, 100, "\t") ) {
    print"<div align=\"center\"><a href=\" $line[1] \"> $line[0] </a></div>";
    }
}


#2 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 18 October 2006 - 01:47 AM

It most likely means that one of the lines in your file does not contain the delimiter -> \t, or the end of your file contains (2) empty lines after the last line with content! fgetcsv(), only allows for a single empty line after the last line with content!


Also what is this...

if( is_file($file($display) ) {

it should be...

if ( is_file ( $display ) {



me!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users