Jump to content

Formatting Boolean Output


liquidprozak

Recommended Posts

I am having a heck of time getting my Admin portion of my site to list a record, which is a Boolean type, as  Yes or No, not as 1 or 0.  I am listing data from MySQL that shows all users who are registered, but under the Admin column, I would like it to say Yes or No, not 1 or 0.  Coldfusion has a nifty command called YesNoFormat(), but alas, it appears there is nothing remotely simple to do this in PHP.  Any help would be greatly appreciated.

Thank you
Link to comment
https://forums.phpfreaks.com/topic/25237-formatting-boolean-output/
Share on other sites

Well, here is a piece from my code.

<div id="content"><!-- InstanceBeginEditable name="TopContent" -->
    <div class="feature">
      <h3>Below is a listing of all news records in the database.</h3>
      <p><a href="add.php">Add a new News Record</a></p>
      <p>&nbsp;  </p>
      <table border="1" cellpadding="1" cellspacing="1">
        <tr>
          <th>Date Added</th>
          <th>Header</th>
          <th>News</th>
          <th>Online</th>
        </tr>
        <?php do { ?>
          <tr>
            <td><a href="edit.php?NewsID=<?php echo $row_rsNews['NewsID']; ?>"><?php echo $row_rsNews['DateAdded']; ?></a></td>
            <td><?php echo $row_rsNews['Header']; ?></td>
            <td><?php echo $row_rsNews['News']; ?></td>
          [color=red][/color]<td><?php echo $row_rsNews['Online']; ?></td>        </tr> [color=red]<-This is where I want to display Yes or no[/color]

          <?php } while ($row_rsNews = mysql_fetch_assoc($rsNews)); ?>
      </table>
    </div>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.