...

View Full Version : PHP to call files and show content of file



nikc121
11-11-2010, 10:51 PM
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);
?>
</p>

mlseim
11-11-2010, 11:40 PM
Remove the semicolon shown in red:


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

nikc121
11-12-2010, 04:42 AM
I did remove it, nothing happend...UGGGGG giving me the same error.

Keleth
11-12-2010, 05:25 AM
First, unsuppress those errors. Next, which line is line 73?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum