Have you tried

SELECT b AS Breakfast FROM tablename


~moe

----- Original Message ----
From: Pete <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, May 12, 2006 12:35:06 AM
Subject: Re: [php_mysql] Need Help With PHP Switch Case???

   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. 

             

        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. 
    
     



[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




Reply via email to