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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:59:01+00:00 2026-05-13T06:59:01+00:00

I have one table which display data as from Dynamic Content in 1 column.

  • 0

I have one table which display data as from Dynamic Content in 1 column. I would like the content to move to a second column when the number of cell is >3. (ie. if there are 3 cells to display, it would be display in 1 col, and 4 cells or more it would be displayed in 2 columns. Note that the dynamic content will never go over 6 cells.

I have to say I can find my way with css and html but javascript is another issue… however I do realize it might be the only way.

Any Javascript , jQuery script available to get my result?

Data to be displayed like so:

| Col1  |          | Col1  || Col2  |
---------          -----------------
| Data1 |   ---->  | Data1 || Data4 |
| Data2 |          | Data2 | etc...
| Data3 |          | Data3 |

Not sure if this would help but the Code calling for the dynamic content (and putting it in the table) is:

<table id="myTable">
                  <?php
     $str1="";
     $flag1=1;
     while($rowReview1=mysql_fetch_array($resultReview1)){
      $st1="";
      $val=$rowReview1["ratingValue"];
      $sName=$rowReview1["criteriaName"];

      if($val>0){

       for($ii=1;$ii<=$val;$ii++){
        $st1.="<img src=\"$directory/images/orange.gif\" \>";
       }

       for($jj=$val;$jj<5;$jj++){
        $st1.="<img src=\"$directory/images/gray.gif\" \>";
       }
      }else{
       $st1="";
      }

      if($val > 0){
       $str1.="<tr><td>$sName</td><td>$st1</td></tr>";
      }else{
       $str1.="<tr><td>$sName</td><td>N/A</td></tr>";
      }
     }
     echo $str1;
    ?>
                </table>

The page can now be seen live here: http://www.top10banques.com/avis/index2.php?item_id=1
The tables I’m trying to edit are the ones below the page break “l’evaluation des clients”.

Thanks again for any help you could provide and Happy Holidays to all!

  • 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-13T06:59:01+00:00Added an answer on May 13, 2026 at 6:59 am

    Assuming you’re using standard table structure, first I would put all your data into one column, regardless of how many there are. Then I would move them dynamically:

    EDIT
    Here’s a working sample of what you’re trying to do. The problem was you have TWO div cells per row, I thought you only had one:

    <html>
    <head>
       <script type="text/javascript"
        src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
       </script>
    </head>
    <body>
        <script type="text/javascript">
          $(function(){
     var allRows = $('#myTable tr');
    if(allRows.length > 3) {
       var extraData = $('#myTable tr:gt(2) td')
       var j = 0;       
       for (i=0;i<extraData.length/2;i++) { 
           $(allRows[i]).append(extraData[j])
           $(allRows[i]).append(extraData[j+1])
           j=j+2;
       }
       $('#myTable tr:gt(2)').remove();
    }
    });
    </script>
    
    <table id="myTable">
    <tr><td>Data1</td><td>Data11</td></tr>
    <tr><td>Data2</td><td>Data21</td></tr>
    <tr><td>Data3</td><td>Data31</td></tr>
    <tr><td>Data4</td><td>Data41</td></tr>
    <tr><td>Data5</td><td>Data51</td></tr>
    <tr><td>Data6</td><td>Data61</td></tr>
    </table>
    
    </body>
    </html>
    

    NOTE the above solution will only work to your exact specifications. If you want this to be reusable (ie, takes any number of rows with any number of cells), you may have to do some additional tweaking.


    WORKING UPDATE FOR MULTIPLE TABLES

    See the code I posted here on Pastie: http://pastie.org/755963

    Note that the tables are now referenced by classes instead of ids. Also, I want to say that I agree that this solution could (and maybe should) be handled server side, I am merely answering the question as the OP asked…

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

Sidebar

Ask A Question

Stats

  • Questions 298k
  • Answers 298k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer jRails works for Rails 2, overriding various functions to get… May 13, 2026 at 7:37 pm
  • Editorial Team
    Editorial Team added an answer It exists other constant for the device orientation: typedef enum… May 13, 2026 at 7:37 pm
  • Editorial Team
    Editorial Team added an answer You don't need to do anything to reserve memory on… May 13, 2026 at 7:37 pm

Related Questions

I have one table which display data as from Dynamic Content, I want to
I am trying to pull together some data for a report and need to
My DAL is created using Linq and all is fine. However, on one page,
I asked a similar question yesterday which may have been poorly worded, either way
Well, simple question. I'm working with VS2008 on an ASP.NET web application which has

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.