Page 1 of 1
PHP code doesn't work if duplicated ???
Posted: Sun Jun 13, 2010 1:27 pm
by pip4u
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 ???
Posted: Sun Jun 13, 2010 1:44 pm
by pip4u
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!
Re: PHP code doesn't work if duplicated ???
Posted: Sun Jun 13, 2010 2:00 pm
by hypedupdawg
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
Re: PHP code doesn't work if duplicated ???
Posted: Sun Jun 13, 2010 2:13 pm
by pip4u
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.
Re: PHP code doesn't work if duplicated ???
Posted: Sun Jun 13, 2010 2:24 pm
by hypedupdawg
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 ???
Posted: Sun Jun 13, 2010 2:32 pm
by pip4u
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.
Re: PHP code doesn't work if duplicated ???
Posted: Sun Jun 13, 2010 5:28 pm
by internet-solution
why not just copy the file in your OS and then change non-php part?