From: "Mike Zornek" <[EMAIL PROTECTED]>
> I'm making a conscience effort to improve my PHP skills, that being making > objects, unit testing, better error handling etc. So I have a questions. > > I have a database that is storing all of my records. One column is of type > enum where the two legal values currently are "home" and "work"; "work" is > default. I'm building a PHP object that will be my interface to the DB. In > the object I have a variable called $EmailType which will hold the value of > the database column. I wrote some set and get methods to work with the > variable and am now asking myself: What should I do if someone tries to set > $EmailType to a value that is not listed in the enum set? Either throw an error and stop the whole action from completing, or just silently ignore it and give it the default value. I would go with the second action, personally. If you're giving the user a clear way of choosing "home" or "work", like radio buttons or a dropdown and you receive another value, someone is trying to pull something. I'd log the error somewhere for future analysis and then just give them the default. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php