PHP code doesn't work if duplicated ???
Moderator: General Moderators
PHP code doesn't work if duplicated ???
Hi, I am trying to accomplish what should be a very simple task: duplicating PHP code from one PHP file to another whilst getting both PHP files to work exactly the same. However, copying and pasting PHP code from File 1 to File 2 causes File 2 to simply display a blank page whilst File 1 works perfectly fine. It's EXACTLY the same code, with nothing different in the non-PHP code that could possibly cause File 2 to not work. I'm not sure what I could possibly be missing here. Any help would be appreciated.
Re: PHP code doesn't work if duplicated ???
In fact, I've tried leaving the NON-PHP code EXACTLY the same too, such that both files are essentially EXACTLY THE SAME in content. Yet File 1 works fine whilst File 2 still doesn't work!
- hypedupdawg
- Forum Commoner
- Posts: 74
- Joined: Sat Apr 10, 2010 5:21 am
Re: PHP code doesn't work if duplicated ???
Do you have the files to upload? If so, that would be a great help.
I would also say - are these files stand-alone? Do they run from / require resources from any other files? If so this may be the cause of your problems. Could you attach any files that MAY BE relevant, then I can check through them
I would also say - are these files stand-alone? Do they run from / require resources from any other files? If so this may be the cause of your problems. Could you attach any files that MAY BE relevant, then I can check through them
Re: PHP code doesn't work if duplicated ???
I just figured it out. It wasn't really anything specifically related to PHP, although the error occurred within the PHP code. The issue was related to changes in syntax. For some reason duplicating the code modified it very slightly by causing a character to disappear - two actually - namely, a closing quote (") after each of two instances of a special character that acts as a parameter. Re-adding the quotes fixed the issue immediately.
- hypedupdawg
- Forum Commoner
- Posts: 74
- Joined: Sat Apr 10, 2010 5:21 am
Re: PHP code doesn't work if duplicated ???
Interesting - did you duplicate the code or the file? And which editor were you using? After all, I really don't want it to happen to me 
Re: PHP code doesn't work if duplicated ???
I duplicated the code, although duplicating the file should achieve the same effect. Apparently the editors I am using (Notepad or Notepad++, off or on SmartFTP) are unable to translate particular special characters (such as the pound symbol) upon duplication, which in turn causes any such character to revert to some alternative possibly unreadable character and/or cause the character's closing quote to disappear. To resolve this issue, I must first duplicate the code, then copy and paste the special characters (e.g. the pound symbol), etc. to fix the syntax errors that occur upon duplication.
-
internet-solution
- Forum Contributor
- Posts: 220
- Joined: Thu May 27, 2010 6:27 am
- Location: UK
Re: PHP code doesn't work if duplicated ???
why not just copy the file in your OS and then change non-php part?