Forum Moderators: coopster

Message Too Old, No Replies

functions.php file?

I am having trouble with a functions.php file and have some QUICK questions

         

GamingLoft

11:23 pm on Jan 21, 2008 (gmt 0)

10+ Year Member



K i am making a registration system and i have SOME knowledge on php and mysql but i haven't ever attempted something as big as this. I usually had just made addon scripts for forums, etc... where i just used the code that had been previously given and changed it up a-bit to make it work my way, BUT, now that im creating my own work from scratch i am COMPLETLY lost.

So i am trying to make a functions.php file that i will include in my script to just make the code cleaner etc. (I don't know if anybody else ever does this, but its what i want) I have A LOT of errors in my functions and i've tried for the past 3 hours to get rid of them, i get errors when running functions.php like...

Parse error: syntax error, unexpected '{' in /home/#*$!x/public_html/#*$!/functions.php on line 19

unexpected T_Variable...

unexpeected T_ELSE...

all kinds of things, but i moved stuff around and NOTHING seems to work!

My Questions:
1. What am i doing wrong.
2. How do i fix it.
3. Is it cool/helpful/useful to make a functions.php file?

(ALSO IF YOU CAN I HAVE SOME QUESTIONS ABOUT arrays, please see my other topic :) thanks)

[edited by: coopster at 11:36 pm (utc) on Jan. 21, 2008]
[edit reason] removed code dump [/edit]

coopster

11:44 pm on Jan 21, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I removed the code dump as it is not necessary at this time and although your "bad language filter" was innocent enough, the language itself even in code form may be offensive to some readers. Thanks for understanding ;) Please review our forum Charter [webmasterworld.com] for Posting Guidelines.

Yes, it is common to use a "functions.php" script as you mention. Quite common. First, I see you have your error_reporting [php.net] turned on while you are developing so you can see your messages. This is a good thing! But do not forget to log your errors on your production machine as opposed to dumping errors to the browser. Users don't understand the cryptic error messages and they can be a security risk. So, keep that in mind.

Instead of moving too many things around, take each message one at a time. Locate the line number in your script that the message applies to and figure out what is wrong with that line. Fix the code and try your script again. Move on to the next error until they are all fixed.

GamingLoft

1:14 pm on Jan 26, 2008 (gmt 0)

10+ Year Member



ah, i completly forgot about my bad language filter :¦

im terribly sorry.

thanks for the input working on it now.

coopster

3:42 pm on Jan 26, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



No worries :)
We're here if you get stuck!