GrantDouglas Posted August 7, 2009 Share Posted August 7, 2009 Ok so my script writes to a log file (which is variable $banned). It needs to insert the text so it appears like this $ip[] = '0.0.0.0'; here is what i have tried but i can't seem to get it to work. fwrite($banned, "$ip[] = '$user';"); the error produced is: Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ultimate/public_html/bomber/editban.php on line 6 line 6 being the line i showed you Im fairly new to php so any help at all would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
GrantDouglas Posted August 7, 2009 Author Share Posted August 7, 2009 Sorry i mean it needs to look like this in the document: $ip[] = '0.0.0.0'; Quote Link to comment Share on other sites More sharing options...
waterssaz Posted August 7, 2009 Share Posted August 7, 2009 Try this :-) <?php $string = "\$ip[] = '"."".$user."'"; fwrite($banned, $string); ?> Quote Link to comment Share on other sites More sharing options...
alexdemers Posted August 7, 2009 Share Posted August 7, 2009 Or make use of single quotes. <?php fwrite($banned, '$ip[] = \''.$user.'\';'."\n" ); ?> Quote Link to comment Share on other sites More sharing options...
GrantDouglas Posted August 7, 2009 Author Share Posted August 7, 2009 Thank you. It worked :-D 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.