Jump to content

Php problem- Syntax error, unexpected t_string line 3


Weakwill

Recommended Posts

the fopen() function expects at least two parameters. Those first two parameters must be string. You can either pass a string as a quoted piece of text in double or single quotes or as a variable:

"foo"

'foo'

$var = "foo";

 

In your line of code you have the first parameter using two single quote marks followed by the text lovell.txt. For the second parameter you have the letter a enclosed in two sets of single quote marks. You should either user one set of single quote marks or one set of double quote marks. Two concurrent single-quote marks is not the same as a double-quote mark

 

$handle = fopen('lovell.txt', 'a');

 

Or

$handle = fopen("lovell.txt", "a");

So, for some reason it seems my problem has switched lines now, it now appears on line 6.. sorry for the inconvienience but can any of you figure this out then? Ill be adding in additional lines to see if theres any problems there aswell.

fwrite($handle, $variable)

fwrite($handle, '',,'');      <---- this is the line

fwrite($handle, $value);

fwrite($handle, ''\r\n'');

}

fwrite($handle, ''\r\n'');

fclose($handle);

exit;

?>

You should either user one set of single quote marks or one set of double quote marks. Two concurrent single-quote marks is not the same as a double-quote mark

 

Let me rephrase:

 

Two single-quote marks do not a double-quote make.

 

Look at your code. There are three separate lines in the code you just posted where you have used two-single-quote marks as double-quotes (twice in each line).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.