>
> You should never hard code values into your program. What happens when
> someone decides to add a new meal, Dinner, for example? In the case
> above, all you have to do is add
> "D", "Dinner"
> into the database, no code changes required.
Pete, I tend to agree with you there, but I would not go as far as to say
"never." If there's little chance that the hard-coded data will change and
the database needs to be kept as simple as possible, I'd find it acceptable
to handle the conversion in the program.
One disadvantage of pulling the data from a table and just throwing it on
the screen without further processing is that you can't really control the
display anymore. If somebody introduces a new meal code like "Five-course
Fundraising Dinner", for instance, chances are that the unexpectedly long
string will screw up the entire page layout. Sure, it's an extreme example
and you can limit the field length in the table to prevent it, but to cover
every possibility that may come up in the future, even a simple case like
this can get complicated rather quickly...
Cheers,
Ray
[Non-text portions of this message have been removed]
The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning.
SPONSORED LINKS
| American general life and accident insurance company | American general life insurance company | American general life |
| American general mortgage | American general life insurance | Computer internet security |
YAHOO! GROUPS LINKS
- Visit your group "php_mysql" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
