So first, I would just like to inform you that I'm no "genius" or whatever in what I do. It might be a silly syntax error, but please, help me out here. I've been trying for hours. I really appreciate it.
So the syntax error message was
Parse error: syntax error, unexpected '=' in -filename- on line -linenumber-
just as in the title. I've marked the line number where the error occurs, so you don't have to worry about that.
$file = fopen("blog.txt", "r");
$dl = 1;
$fl = 0;
$readstr = "";
while(! feof($file)) {
$fileline = fgets($file);
if ($fileline == "") {
break;
}
if(dl == 1) { //heading
echo "<h3>".$fileline."</h3>";
}
else if(dl == 2) { //date
echo "Uploaded on ".$fileline."<br />";
}
else if(dl == 3) { //content
--> dl = 0;
echo $fileline;
}
fl++;
dl++;
}
fclose($file);
I just don't get it. What's wrong in that line? dl = 0. I don't see any syntax error at all near that area.
As you are coding in the PHP platform, you need to maintain some convention of variable declaration. Take a deep look in you script, several time you use dl
and fl
without the $
sign, so you need correct them.
Rules for PHP variables: Online Guide