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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:29:42+00:00 2026-06-08T02:29:42+00:00

I have six columns of output. The content is grabbed from an array (created

  • 0

I have six columns of output. The content is grabbed from an array (created as a php array and then sent as a js array). An sample line of that comprises the array $set is as follows:

 $set[] = array('q'=>'墨水','qurl'=>'001','a1'=>'o','a2'=>'ui','f'=>'m','m'=>'4sh','e'=>'3');

Lets say I have four rows of content. My code currently generates this:

Col 1 Col 2 Col 3 Col 4 Col 5 Col 6
Col 1 Col 2 Col 3 Col 4 Col 5 Col 6
Col 1 Col 2 Col 3 Col 4 Col 5 Col 6
Col 1 Col 2 Col 3 Col 4 Col 5 Col 6

I need to put these four rows into two primary sets of columns. So like this:

Col 1 Col 2 Col 3 Col 4 Col 5 Col 6        Col 7 Col 8 Col 9 Col 10 Col 11 Col 12
Col 1 Col 2 Col 3 Col 4 Col 5 Col 6        Col 7 Col 8 Col 9 Col 10 Col 11 Col 12

What is an efficient way of doing this? My current code looks like this:

…
$js_array = json_encode($set);
…


<table>
    <?php $counter = 0;
    while ($counter < 20) :
    $item = $set[$counter]?>
        <tr class="q<?php echo $counter; ?>">                   
            <form>
            <td><h5><?php echo $counter+1; ?></h5></td>
            <td><a class="question" href="javascript:soundManager.play('<?php echo $item['qurl'] ?>','audio/part2/type3/type3_<?php echo $item['qurl'] ?>.mp3');"><?php echo $item['q'] ?></a></td>
            <td><?php echo $item['f'] ?></td>
            <td><input class="a1" type="text" name="a1" maxlength="4" size="2" /></td>
            <td><?php echo $item['m'] ?>&nbsp;<input class="a2" type="text" name="a2" maxlength="4" size="2" /><?php echo $item['e'] ?></td>
            <td><input class="submit submit-<?php echo $counter; ?>" type="submit" value="Submit" /></td></form>
        </tr>
    <?php $counter++; ?>
    <?php endwhile; ?>
</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-08T02:29:44+00:00Added an answer on June 8, 2026 at 2:29 am

    You can do it as follows:

    $total = 24;
    
    //loop through rows     
    for($i = 0; $i < $total; $i++) {
        //start new table?
        if($i == 0 || $i == ($total/2)) {
            if($i > 0) { //second table cell values
                echo '</table>';
                $j_val = 7;
                $j = $j_val;
            } else { //first table cell values
                $j_val = 1;
                $j = $j_val;
            }
    
            echo '<table>';
        }
    
        echo '<tr>';
    
        $total_cells = ($j + 6);
    
        for(; $j < $total_cells; $j++) {
            echo '<td>' . $j . '</td>';
        }
    
        //reset j to default
        $j = $j_val;
    
        echo '</tr>';
    }
    
    echo '</table>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have six wcf services that I'm hosting in a windows service. Everything works
I have six SQL queries that I script though R that each take a
I have a sharepoint page that loads six webparts, each one of them consumes
I have a query pulling the last six months of data from a table
I have a table that contains, among other things, about 30 columns of boolean
I have a MySQL table ( members ) with six columns ( FirstName, LastName,
i have a sqlite3 database that has multiple (six) tables and i need it
I have six tables, which unfortunately does not have any primary/foreign key-relations encoded. I've
I am trying to plot a graph using gnuplot. I have six text files.
How can I use displayObjects as animation frames? I have six symbols in my

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.