Weakwill Posted September 21, 2011 Share Posted September 21, 2011 Can anyone tell me what's wrong with this particular part of my php code? $handle = fopen(''lovell.txt, ''a''); That was the line it said there was an issue with, and I'm new and can't seem to figure it out. Quote Link to comment Share on other sites More sharing options...
voip03 Posted September 21, 2011 Share Posted September 21, 2011 $handle = fopen(''lovell.txt, ''a''); missing double quotation mark http://www.w3schools.com/php/func_filesystem_fopen.asp Quote Link to comment Share on other sites More sharing options...
Weakwill Posted September 21, 2011 Author Share Posted September 21, 2011 Thanks, where would I make the change though? Could You edit that for me please and thank you. ? Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 21, 2011 Share Posted September 21, 2011 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"); Quote Link to comment Share on other sites More sharing options...
Weakwill Posted September 21, 2011 Author Share Posted September 21, 2011 Thank you very much to you both Quote Link to comment Share on other sites More sharing options...
Weakwill Posted September 21, 2011 Author Share Posted September 21, 2011 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; ?> Quote Link to comment Share on other sites More sharing options...
DavidAM Posted September 21, 2011 Share Posted September 21, 2011 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). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.