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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:03:53+00:00 2026-05-25T18:03:53+00:00

What I would like to do is number each row in my table. I

  • 0

What I would like to do is number each row in my table. I can’t manually number the table myself, as all of the info in it is retrieved from a database. Is this possible with jQuery or PHP? Here’s a screen shot of the table:

Screenshot

I tried searching for this, and did not find anything that helped me.

Here is the PHP / HTML that is displaying the table:

 <tr>
 <th>Name</th>
 <th>Email</th>
 <th>Subject</th>
 <th>Created on</th>
 <th style="width:65px;">Status</th>
 <th>Actions</th>
 </tr>

<?php

[...]

//Display the results
while($info = mysql_fetch_assoc($result)){
//data
$name = $info['name'];
$email = $info['email'];
$subject = $info['subject'];
$ticketid = $info['ticket'];
$isActive = $info['is_active'];
$created = $info['created'];
    //status
    if($isActive == "1") {
    $status = "<span class=\"open\">Open</span>"; 
    $status2 = "active";
    }
    else if($isActive == "0") { 
    $status = "<span class=\"closed\">Closed</span>"; 
    $status2 = "closed";
    }
    else {
    $status = "";
    }
    echo  "
<tr>
<td style=\"min-width: 87px;\">$name</td>
<td style=\"min-width:248px;\" title=\"$email\">".addEllipsis($email, 33)."</td>
<td title=\"$subject\">".addEllipsis($subject, 18)."</td>
<td style=\"width: 235px;\">$created</td>
<td title=\"This ticket is $status2\">$status</td>
<td><a href='/employee/employee.php?ticket=$ticketid'>View Ticket &raquo;</a></td>
</tr>
    ";
}

As you can see, it’s displayed with a while loop.

If anyone knows a way to number each line in my table with jQuery or PHP, please help me 🙂

  • 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-05-25T18:03:54+00:00Added an answer on May 25, 2026 at 6:03 pm

    I would go with PHP solution listed by Atul Gupta.

    To add more – you also can to start iteration based on which page you are.

    <?php
    
    $i = ($page-1) * $itemsPerPage;
    while(....)
    {
        echo $i;
        $i++;
    }
    ?>
    

    if you are on the second page of your list would get something like 11,12,13,14,….

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

Sidebar

Related Questions

I have a mysql table, each row of which can have an arbitrary number
I have a number of table rows that I would like to toggle the
I would like to know if locking my table is necessary in this situation
I would like to generate a random floating point number between 2 values. What
I would like to update a large number of C++ source files with an
I would like to discover the machine architecture type of a big number of
In Java Swing I have a simple table where in each row the name
This seems like it should be simple but I can't find anything yet. In
I store time-series simulation results in PostgreSQL. The db schema is like this. table
I would like to update my SQL lite database with the native update-method of

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.