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");

Link to comment
Share on other sites

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;

?>

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.