Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2010
    Posts
    19
    Thanks
    7
    Thanked 0 Times in 0 Posts

    PHP to call files and show content of file

    Ive been playing around with this all day, I think my path is wrong, I keep getting [Parse error: parse error, unexpected ';' in /class/ct386b/##/www/cgi-bin/french5.php on line 73]
    Here are how my files are set up and I am linking to my college unix system thru my signon ~ct386##
    <secret> inside this is<exercise5>and in that is <content> this folder contains lesson5.txt and vocabulary.txt files. Then under my <cgi-bin> folder if have french5.php. The instructions are pretty simple, I understand what it wants me todo, just cant make it do it.(story of my life)
    INSTRUCTIONS§ 1.Declare a variable named strLessonDescription that contains the contents of the lesson5.txt file. In the declaration, if the opening of the file fails, include the message "Error - lesson5.txt cannot be opened" (without quotes)
    2.within the lessonDescription ID, create a PHP block of code that outputs the contents of the strLessonDescription variable.
    Here is my PHP CODE
    PHP Code:
    <?php

    $StrLessDescription 
    = ("http://nova.umuc.edu/~ct386b##/secret/exercise5/content/lesson5.txt");
    $newfile = @fopen($StrLessDescription"r") or exit ('Error - lesson5.txt cannot be opened');
    $file_contents = @fgetcsv($newfilefilesize($StrLessDescription)) or exit ('Could not read file 

    contents'
    );
    while (
    $i=0$i sizeof($file_contents); $i++);
    {
        echo 
    $file_contents[$i];
        echo 
    "<br/>";
    }
                        
    fclose($newfile);
    ?>
    </p>

  2. #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,831
    Thanks
    8
    Thanked 1,123 Times in 1,114 Posts
    Remove the semicolon shown in red:


    while ($i=0; $i < sizeof($file_contents); $i++);
    {
    echo $file_contents[$i];
    echo "<br/>";
    }

  3. #3
    New Coder
    Join Date
    Oct 2010
    Posts
    19
    Thanks
    7
    Thanked 0 Times in 0 Posts
    I did remove it, nothing happend...UGGGGG giving me the same error.

  4. #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,547
    Thanks
    45
    Thanked 259 Times in 256 Posts
    First, unsuppress those errors. Next, which line is line 73?


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •