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

$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($newfile, filesize($StrLessDescription)) or exit ('Could not read file 

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

You don't state which line in #73.

$file_contents = @fgetcsv($newfile, filesize($StrLessDescription)) or exit ('Could not read file 
 
contents');

This could be the culprit, but I can't say for sure. Try:

$file_contents = @fgetcsv($newfile, filesize($StrLessDescription)) or exit ('Could not read file contents');

I think

while ($i=0; $i < sizeof($file_contents); $i++);

Should be

for($i=0; $i < sizeof($file_contents); $i++)

'for' and no comma at end.

Member Avatar for diafol

true enough vib

Thanks VIB, I did catch that and changed to a for loop, However its seems to be working (somewhat) When I load the page it is showing the error message I created, but I think its suppose to show the content of the text file. Is my path wrong, or maybe the syntax, Ive been playing around with it all night, but still not showing the actual content. The text that is being called is only one sentence.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.