rdaniyal Posted August 11, 2006 Share Posted August 11, 2006 Hi guys,I have a large table with over 20 enums. The result shows Y and N for each column. How can I change the enum Y to yes and N to No?Changing individually can be a bit of pain so if there is a way to change all that will be better. My knowledge is limited with php so kindly elaborate on solution.Thanks.Raja Quote Link to comment Share on other sites More sharing options...
tox_yray Posted August 11, 2006 Share Posted August 11, 2006 I am not sure wether this is what you want, but at the moment of printing the values, you could just do a switch that would echo either "yes" or "no" depending on the letter it received as a $case... You could even functionalize it for better readablility:[code]function ynchar_to_yesnostring($param){ switch($param) { case "y": case "Y": $out = "yes"; break; case "n": case "N": $out = "no"; break; default: $out = ""; break; } return $out;}[/code]An example use of this would be that:[code]$enum = "Y";echo ynchar_to_yesnostring($enum); //would print yes[/code]You might want to make the function name shorter though if you use it often. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.