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

  • SEARCH
  • Home
  • 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 8531803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:34:11+00:00 2026-06-11T09:34:11+00:00

I would like to Zebra Stripe the results table. I can’t find a solid

  • 0

I would like to Zebra Stripe the results table. I can’t find a solid solution. What would I need to do to this table to add a odd/even class to the results rows?

 // HTML ... Aliases from Mysql
echo "<table  class='sortable' id='tablesorter' cellspacing='1' cellpadding='0' border='0' width='920px' >
<thead>
<tr>
<th class='header'>Short Name of Fund</th>
<th class='header'>I/C</th>
<th class='header'>Fund Manager Company</th>
<th class='header'>Class</th>
<th class='header'>Special Class</th>
<th class='header' id='custom'>TTR year-to-date<br /> %</th>
<th class='header'>Mgmt Fee Effectively Charged</th>
<th class='header id='custom'>Total Expenses <br /> %</th>
<th class='header'>Fund Size</th>
</thead><tbody>

</tr>";

//<tr> specifies table row. for each <td> (table data) will specify a new column.  The $row specifies the mysql column name (in this case using an alias)
while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td><a href=\"page.php?id={$row['ID']}\">{$row['Short Name of Fund']}</a></td>";
  echo "<td>" . $row['I/C'] . "</td>";
  echo "<td>" . $row['Fund Manager Company'] . "</td>";
  echo "<td>" . $row['Class'] . "</td>";
  echo "<td>" . $row['Special Class'] . "</td>";
  echo "<td>" . $row['TTR year-to-date %'] . "</td>";
  echo "<td>" . $row['Mgmt Fee Effectively Charged'] . "</td>";
  echo "<td>" . $row['Total Expenses %'] . "</td>";
  echo "<td>" . $row['Fund Size'] . "</td>";


  echo "</tr>";
  }
echo "</tbody></table>";
  • 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-11T09:34:12+00:00Added an answer on June 11, 2026 at 9:34 am

    This should work, the syntax may be incorrect as I have not tested it. But the logic is there.

    $currentState = 'odd';
    $html = '';
    while($row = mysql_fetch_array($result)){
        $currentState = ($currentState == 'odd' ? 'even' : 'odd');
        $html .= '<tr class="'.$currentState.'">';
        $html .= '<td><a href="page.php?id=' . $row['ID'] . '">'. $row['Short Name of Fund'] .'</a></td>';
        $html .= '<td>' . $row['I/C'] . '</td>';
        $html .= '<td>' . $row['Fund Manager Company'] . '</td>';
        $html .= '<td>' . $row['Class'] . '</td>';
        $html .= '<td>' . $row['Special Class'] . '</td>';
        $html .= '<td>' . $row['TTR year-to-date %'] . '</td>';
        $html .= '<td>' . $row['Mgmt Fee Effectively Charged'] . '</td>';
        $html .= '<td>' . $row['Total Expenses %'] . '</td>';
        $html .= '<td>' . $row['Fund Size'] . '</td>';
        $html .= '</tr>';
    }
    echo $html;
    

    EDIT: Updated code so it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I typically zebra stripe table rows for odd / even like so and it
would like to know how can this be implemented in Joomla. I have a
Would like to know how I can improve this code to enable no page
I would like to add a GestureDetector to all views (view groups) of an
Would like to do this: letters: charset ABCDEFGHIJKLMNOPQRSTUVWXYZ pick letters 2 but pick doesn't
Would like to know if methods need to be static in a C# assemble
Would like to implement some solution for adding tags to a certain user profile
Would like to see if someone can help me on figuring out how to
Would like to maintain a map/hash of DOM objects. Can they serve as key
would like to build an app that can run on any of the new

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.