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
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>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.