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 8273967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:36:34+00:00 2026-06-08T07:36:34+00:00

I have a problem here. I’ve tried searching everywhere but can’t seems to find

  • 0

I have a problem here. I’ve tried searching everywhere but can’t seems to find it. I know there’s post about this out there, maybe I can’t get my search query right.

It’s similar to this 2 that I’ve found:
Applying different CSS to top 10 results of a query
.addClass with IF statement based on value

Currently here’s a brief example of my code:

<?php
$select=mysql_query("select * from products_list ORDER BY id ASC");
while($row=mysql_fetch_array($select)){
echo "<tr>
<td>".$row['id']."</td>
<td>".$row['title']."</td>
<td>".$row['new_arrival']."</td>";
?>

The data for new_arrival in the database is either yes or no.

My question is how do I add a class for the “new_arrival” on the TD if it is “yes” and no class added if it is “no”

Hope you guys understand what I’m trying to say. Thanks.

Regards,
Jeff

  • 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-08T07:36:34+00:00Added an answer on June 8, 2026 at 7:36 am
    <?php
    
        $select = mysql_query( "SELECT * FROM products_list ORDER BY id ASC" );
        while( $row = mysql_fetch_array( $select ) ) {
    
            $class = '';
            if ( $row[ 'new_arrival' ] == 'yes' )
                $class = ' class="your_class" ';
    
            $result = "<tr>
                        <td>" . $row['id'] . "</td>
                        <td>" . $row['title'] . "</td>
                        <td" . $class. ">" . $row['new_arrival']  ."</td>
                      </tr>";
    
            echo $result;
        }
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At first - yes, I've tried to find my problem here, but can't make
I have a problem here using .dbf files. I can make CRUD operations but
I have problem adding arraylist to list view, will explain about my problem here..
I have a problem here I can't solve. I have a database of houses
I have another problem here. I have few repeating groups of divs. There is
I have a problem here. I have about 13K rows of data that I
I have a problem here and it seems that my brain has just left
i have a problem here. I need it so if there is no text
I have a problem here, which I've not come across before and can't seem
I know the questions sounds very familiar on SO but I have different problem

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.