hi there. my current project is to be my first venture into purely object oriented structure for database access ( as much as is practical... at least).
this probably doesn't have as much to do w/ classes and their lot as it does with basic development methodology-- or even strategic HTML form planning. i dunno..
okay-- i just realized that the several "blank entries" here in the test (MySQL 5) database i'm using on localhost are probably NOT going to be in the production model. (meaning-- throughout development thus far, i've duplicated entries by hitting submit multiple times, and all that jazz-- you've probably been there). i've left the blank stuff in there-- at first just because it didn't occurr to me that it's not a real reflection of what might be in production, but then i thought-- why not design the app to handle NULL entries... ya never know what kind of circumstance previously unrevealed might lead to such an entry by the client, and if the app can't handle a blank field where all of the code is designed to have values... then i suppose that's going to be a problem.
i may not be that great w/ programming-- but i do try to plan ahead. perhaps one of the reasons i am where i am (ie. this is my first venture w/ OOP stuff...) is because of the extensive amout of trial and error i tend to do in quite an OCD sort of habit. if nothing else, i suppose i've at least partially filled the emptiness left by the lacking of formal CompSci / software engineering education. blah, blah...
i'm looking for opinion from those of you who've been around the block (or those of you who are in that trial and error learning stage-- because of your attention to detail and fresh-minded research). How would you handle the situation in which queries might be executed on fields which aren't populated? OR-- perhaps i could reverse that, and perhaps more the responsible method-- to avoid letting NULL values go into the database at all-- with good ol' conditional logic, or flow control even based on MySQL error and/or javascript magic (although i'd rather avoid javascript for accessibility's sake).
here i face two problems:
1.) i'm unfamiliar w/ technique for using mysql error to control flow-- i tend to just think of an app 'breaking' when there's a mysql error-- but i know it doesn't need to be that way (for use of an "Error_Handler" class, perhaps?)
2.) i'm undecided on how to approach it-- "if / then" logic? or perhaps something more simple, tied to the HTML Form itself-- disallowing an incomplete entry.
hmmm... i feel kinda stupid asking for advice on this-- considering it's probably a rather rudimentary concept, but i'd rather feel stupid here w/ you than to feel stupid telling a client why his app is all messed up. hehe
thanks!!