0

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);
?>
3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by vibhaJ
0

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');
0

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.

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.