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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:46:42+00:00 2026-06-06T02:46:42+00:00

I have a db where I manually add data. Some of the fields are:

  • 0

I have a db where I manually add data. Some of the fields are:

ID AA Name Percentage(will be changing once a week)

1   2.  Me     10%

2   1.  You    40%

When I call the db with my dynamic list I get all names sorted By Perentage. The AA column I need it in order to get this result:

1. You  40%
2. Me   10%

It’s easy to manually play with AA column (since my entries are no more than 10-15) and match it with the Percentage so I get the correct display that I need.

But if my entries become e.g 30 it will be very difficult to change all the time the AA column to match with the Percentage one.

So is there any modification I can do to my dynamic_list.php so I get the
1.
2.
generated automaticaly? Here is my dynamic_list.php:

$sql = mysql_query("SELECT * FROM clients WHERE Category='Deksioseis' ORDER BY percentage DESC");
$productCount = mysql_num_rows($sql);
// count the output amount
if ($productCount > 0) {
        $i=0;
            $dynamicListDeks = '<table id="pl_list" class="list">';
            while($row = mysql_fetch_array($sql)){
                $id = $row["ID"];
                $aa = $row["AA"];
                $client_name = $row["Client_Name"];
                $short_name = $row["Short_Name"];
                $details = $row["Details"];
                $percent = $row["Percentage"];
        $dynamicListDeks .= ($i==0) ? '<tr>':'';
        $dynamicListDeks .= '<td class="lst_aa">
                        ' . $aa . '
                     </td>
                                     <td class="lst_l">
                        <img src="../rooms/' . $short_name  . '.png" alt="' . $client_name . '" />
                     </td>
                     <td class="lst_nam">
                        <a id="' . $short_name . '" name="' . $short_name . '" class="room">' . $client_name . '</a>
                                     </td>
                     <td class="lst_det">
                    ' . $details . '
                     </td>
                         <td class="lst_per">
                    ' . $percent . '%
                    <br />
                     </td>';
        $dynamicListDeks .= ($i==1) ? '</tr>':'';
        $i++;
        ($i==2) ? $i=0:'';
        }
        $dynamicListDeks .='</table>';
        } else {
            $dynamicListDeks = "";
            }
        mysql_close();
  • 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-06T02:46:44+00:00Added an answer on June 6, 2026 at 2:46 am

    Keep a counter in your PHP code that you increment for each run of the loop:

    $aa = 0;
    while($row = mysql_fetch_array($sql)){
      $id = $row["ID"];
      $aa++;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webpage for example www.testing.example.com/home , now if someone manually add script
I have a DataTable that I manually created and loaded with data using C#.
I have an address block on a view which can swap some data if
I have a strange problem. I am trying to update some fields using linq
In my table I have looked manually and found that the top three idle
Is there a way that I manually have a user look up the current
I have a number of manually written scripts (.sql) for tables, views and stored
I have researched how to manually include a PlaceHolder Text in UITextView (as there
I have a DataGridView where I manage manually the focused cells when navigating with
I have a form which I create manually (a lot of JavaScript in it...).

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.