Cory94bailly Posted February 17, 2009 Share Posted February 17, 2009 Parse error: syntax error, unexpected T_STRING in /home/cory/htdocs/massattack/includes/log.php on line 5 if(!is_dir("/home/cory/logs/LogFolder/" date("Y")){ mkdir("/home/cory/logs/LogFolder/" date("Y"), 0777); } if(!is_dir("/home/cory/logs/LogFolder/" date("F")){ mkdir("/home/cory/logs/LogFolder/" date("F"), 0777); } I am trying to check if there is a folder with the year then the month (if there isnt, make them).. Line 5 is: if(!is_dir("/home/cory/logs/LogFolder/" date("Y")){ (The variable "LogFolder" is defined in a config file btw..) The thing that is wrong is how I 'worded' the folder name to include the year, I took out the year part and got no error.. This should take like 5 mins to fix Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 17, 2009 Share Posted February 17, 2009 To add something to string, you use concatenation operator (a dot .) if(!is_dir("/home/cory/logs/LogFolder/".date("Y")) Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted February 17, 2009 Author Share Posted February 17, 2009 To add something to string, you use concatenation operator (a dot .) if(!is_dir("/home/cory/logs/LogFolder/".date("Y")) Ah, I knew it was a dot but I didn't know where Since you gave me that info, I looked at the script, noticed it doesn't do what I wanted it to do and I came up with this: if(!is_dir("/home/cory/logs/".LogFolder."/".date("Y"))) { mkdir("/home/cory/logs/".LogFolder."/".date("Y"), 0777); } if(!is_dir("/home/cory/logs/".LogFolder."/".date("Y")."/".date("F"))) { mkdir("/home/cory/logs/".LogFolder."/".date("Y")."/".date("F"), 0777); } It does exactly what I want and actually works, now I have to keep improving from that. I forgot that variables can't be in quotes Thanks Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 17, 2009 Share Posted February 17, 2009 They can... and if LogFolder is a variable, it should have $ in front of it. if(!is_dir("/home/cory/logs/$LogFolder/".date("Y"))) { Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted February 17, 2009 Author Share Posted February 17, 2009 They can... and if LogFolder is a variable, it should have $ in front of it. if(!is_dir("/home/cory/logs/$LogFolder/".date("Y"))) { Well, I meant it's defined.. Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 17, 2009 Share Posted February 17, 2009 Its constant not a variable then Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted February 17, 2009 Author Share Posted February 17, 2009 Its constant not a variable then That's what it's called? Ok, thanks for the info 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.