Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7836369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:06:46+00:00 2026-06-02T14:06:46+00:00

I have a table where one of the values is either Yes or No.

  • 0

I have a table where one of the values is either Yes or No. I would like to have the value represented by an image according to the value. Table is also using pagination and am using code to alternate row color. Code:

<?php 

$sql = "SELECT * FROM txmit ORDER BY id ASC LIMIT $start_from, 25";

$rs_result = mysql_query ($sql);
$num_rows = mysql_num_rows($rs_result);
$query = mysql_query("SELECT * FROM txmit"); 
$number=mysql_num_rows($query);

`while($rows=mysql_fetch_array($rs_result)){

// If $color==1 table row color = #747E80
if($color==1){
echo "<tr bgcolor='#DBDBDB'>
<td>.$rows['pid']."</td><td>".$rows['sent']."</td></tr> 
?>

The $rows[‘sent’] is the Yes or No value…how do I get it to display image based on Yes or No value.
thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T14:06:56+00:00Added an answer on June 2, 2026 at 2:06 pm

    You could do this:

    echo "<img src=img/" . $rows['sent'] == 'Yes' ? 'yes.png' : 'no.png' . ">";
    

    If they’re really just Yes and No you could also use:

    echo "<img src=img/" . $rows['sent'] . ".png>"; // Yes.png or No.png
    

    If the image path gets a bit longer I’d agree with Blazemonger’s comment and make it more readable:

    echo '<img src=very/long/image/path/';
    
    if($rows['sent'] == 'Yes') {
        echo 'yes.png >';
    } else {
        echo 'no.png >';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table like this one: id group value 1 GROUP A 0.641028
I have a boolean column in one of my tables (value is either 0
I have one table view that should be filtered by values of search field
I have a table of many values where one column has the WO Number,
I have a table and want to get 15 values with one order and
i have a large mysql database table in which one column contains values ranging
I have one table TABLE_EXAM . i need to update the value of specific
I have one database table TABLE_TIPS with two value 1. tips_id (auto increment) 2.
I have a checkboxlist.When I check one the value will appear in a table.Now
i have day, month, year, value columns in one table, here i need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.