0
PHP Yes/No or True/False Function

/t5/dreamweaver-discussions/php-yes-no-or-true-false-function/td-p/3768
Oct 21, 2006
Oct 21, 2006
Copy link to clipboard
Copied
I have a dynamic table that shows the fowllowing...
<td><?php echo $row_rsAnnouncement['online']; ?></td>
I am using MySQL database, and it is "tinyint".
When I view it, it shows either 0 or 1. How can I make this online field to say Yes or No. If that is not possible even if it is shows a True or False I can be happy with that.
I know that in Coldfusion there is a function called #YesNoFormat()#, is there one for PHP?
Thank you,
AdonaiEchad
<td><?php echo $row_rsAnnouncement['online']; ?></td>
I am using MySQL database, and it is "tinyint".
When I view it, it shows either 0 or 1. How can I make this online field to say Yes or No. If that is not possible even if it is shows a True or False I can be happy with that.
I know that in Coldfusion there is a function called #YesNoFormat()#, is there one for PHP?
Thank you,
AdonaiEchad
TOPICS
Server side applications
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/php-yes-no-or-true-false-function/m-p/3769#M186913
Oct 21, 2006
Oct 21, 2006
Copy link to clipboard
Copied
<td><?php echo
($row_rsAnnouncement['online']=="1"?'Yes':'No'); ?></td>
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"AdonaiEchad" <webforumsuser@macromedia.com> wrote in message
news:ehe5gv$koi$1@forums.macromedia.com...
>I have a dynamic table that shows the fowllowing...
>
> <td><?php echo $row_rsAnnouncement['online']; ?></td>
>
> When I view it, it shows either 0 or 1. How can I make this online field
> to
> say Yes or No. If that is not possible even if it is shows a True or
> False I
> can be happy with that.
>
> I know that in Coldfusion there is a function called #YesNoFormat()#, is
> there
> one for PHP?
>
> Thank you,
> AdonaiEchad
>
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"AdonaiEchad" <webforumsuser@macromedia.com> wrote in message
news:ehe5gv$koi$1@forums.macromedia.com...
>I have a dynamic table that shows the fowllowing...
>
> <td><?php echo $row_rsAnnouncement['online']; ?></td>
>
> When I view it, it shows either 0 or 1. How can I make this online field
> to
> say Yes or No. If that is not possible even if it is shows a True or
> False I
> can be happy with that.
>
> I know that in Coldfusion there is a function called #YesNoFormat()#, is
> there
> one for PHP?
>
> Thank you,
> AdonaiEchad
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/php-yes-no-or-true-false-function/m-p/3770#M186914
Oct 21, 2006
Oct 21, 2006
Copy link to clipboard
Copied
Murray *ACE* wrote:
> <td><?php echo ($row_rsAnnouncement['online']=="1"?'Yes':'No'); ?></td>
Even simpler:
<td><?php echo $row_rsAnnouncement['online'] ? 'Yes' : 'No'; ?></td>
If a variable contains 0, it's an implicit Boolean false. Any other
number (or string) is an implicit Boolean true.
--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
> <td><?php echo ($row_rsAnnouncement['online']=="1"?'Yes':'No'); ?></td>
Even simpler:
<td><?php echo $row_rsAnnouncement['online'] ? 'Yes' : 'No'; ?></td>
If a variable contains 0, it's an implicit Boolean false. Any other
number (or string) is an implicit Boolean true.
--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/dreamweaver-discussions/php-yes-no-or-true-false-function/m-p/3771#M186915
Oct 21, 2006
Oct 21, 2006
Copy link to clipboard
Copied
Thank you so much, I really appreciate all your work, thank
you both it has been most helpful.
AdonaiEchad
AdonaiEchad
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/dreamweaver-discussions/php-yes-no-or-true-false-function/m-p/3772#M186916
Oct 24, 2006
Oct 24, 2006
Copy link to clipboard
Copied
Thank you again David for all of your help on this project.
Thank you,
AdonaiEchad
Thank you,
AdonaiEchad
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

