Thanks for your thoughts Jason. In reference to the KISS method you mentioned.. ( taking a quick deep
breath... I resemble that remark!! ;) )
No, actually, the way I normally structure my code is on each page I do the following:
<?php
/* All includes and requires go here */
/* local functions go here */ /* Start by calling Main() */ main();
function main(){
A C coder? ;)
... php code here...
}
?>
<!--- HTML code here -->
<HTML>
<HEAD> <TITLE></TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
It's just when I look at my code it seems too simple as though I'm doing something wrong. Like when I call a function to add/update/delete data to/from a table, I'm not sure if I should display any errors that arise or
First, check out this link: http://www.php.net/manual/en/function.set-error-handler.php
So in general a good way to handle things is to trigger an error (with trigger_error imagine that :) and pass the error message that way. Then your error handler can do with it whatever it needs to do (email you, log it, echo, etc.). This makes it easier to switch over from development to production (and back again when something breaks :(
IMO anything that is a message should just be plain text returned / stored in some variable. This makes it easy to handle and pass on to other functions. You can also go all-out and use error classes / exceptions, but they aren't *really* necessary. But useful.
log them. My understanding with errorhandling is limited. I was thinking
that if I take all related functions that go together with a user, and put
them into a User object would be better.
Hopefully all this makes sense to everyone.
Thanks again for your input.
Jim
-- Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php