In message <[EMAIL PROTECTED]>, William Watson
<[EMAIL PROTECTED]> writes
>My question is, "How can I read the value "B" from the mealcode field in
>the mysql database as "B", but tell my Online reporting program to
>convert the "B" into the word Breakfast?" I need to do the same thing
>with Lunch. This is so the children's parents who are viewing their
>child's account will see the word Breakfast, instead of only seeing a
>"B", and the same goes for "L" (show the word Lunch instead).

Don't do it that way...

Create a new table, which contains 2 fields, mealID and mealName.  In
your case, it will have 2 records
"B", "Breakfast"
"L", "Lunch"
and look up the mealName whilst you are interrogating the main database.
It will be one SQL command.

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.

OK, in your case, there is little chance of a change, but if you can
absolutely guarantee that nothing will change,
then it will be a first <G>

Do you know how to collect data from two tables at once?

--
Pete Clark

Free advertising for your website, business, or organisation at:
http://www.hotcosta.com/resources.php




The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning.



YAHOO! GROUPS LINKS




Reply via email to