Forum Moderators: coopster

Message Too Old, No Replies

What is PHP's YesNo format function?

Is there such a function?

         

cosmoyoda

11:09 pm on Dec 28, 2007 (gmt 0)

10+ Year Member



Hello.

I'm working with PHP and MySQL and for some reason I need to format the checkbox (0,1) format to the more human readable format of "Yes and No". How can I accomplish this with PHP?

Basically I have a table of users and there is a column called "Allowed?". The result can be either 0 or 1, but I want to make it Yes or No instead. What function should I use?

Thanks in advance for your help.

mikesmith76

2:19 pm on Dec 29, 2007 (gmt 0)

10+ Year Member



don't think there is a built in function to do this but would be very simple to implement. a simple if statement should suffice

something like

$allowed = '0';

if( $allowed == '1' )
{
print "Yes";
}
else
{
print "No";
}

cosmoyoda

7:44 pm on Dec 29, 2007 (gmt 0)

10+ Year Member



Great idea, this is what I did before you replied.

Thank you for your help!