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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:18:09+00:00 2026-05-24T04:18:09+00:00

I am wanting to make the data to show in 2 columns instead of

  • 0

I am wanting to make the data to show in 2 columns instead of one here is the code I currently use to show the data in 1 column:

    <?php 
include("config.php");
include("opendb.php");
$get_cats = mysql_query("SELECT * FROM `categories` ORDER BY `displayorder`") or die(mysql_error());
$get_info = mysql_query("SELECT * FROM `systeminfo`") or die(mysql_error());
$info = mysql_fetch_array($get_info);
while($cats = mysql_fetch_array($get_cats)) {
$get_rares = mysql_query("SELECT * FROM `rares` WHERE `catid`='".$cats['id']."'") or die(mysql_error());
echo("<h2>".$cats['name']."</h2><br>
<table width=\"100%\" border=\"0\">
<tr>
<td width=\"20%\" style=\"text-align:center\"><b>Image</b></td>
<td width=\"40%\" style=\"text-align:left\"><b>Item Name</b></td>
<td width=\"10%\" style=\"text-align:center\"><b>Value</b></td>
<td width=\"30%\" style=\"text-align:center\"><b>Last Updated</b></td>
</tr>
");
$color1 = $info[stripe1]; 
$color2 = $info[stripe2];
$row_count = 0;
while($rare = mysql_fetch_array($get_rares)) {
$row_color = ($row_count % 2) ? $color1 : $color2;
?>
<tr>
<td width="5%" style="text-align:center;background-color:#<?php echo $row_color; ?>"><img alt="" src="<?php echo("".$info[imagepath]."".$rare['image'].""); ?>"></td>
<td width="20%" style="text-align:left;background-color:#<?php echo $row_color; ?>"><?php echo $rare['name']; ?></td>
<td width="20%" style="text-align:center;background-color:#<?php echo $row_color; ?>"><?php echo $rare['value']; ?> Credits</td>
<td width="10%" style="text-align:center;background-color:#<?php echo $row_color; ?>"><?php echo $rare['lastedited']; ?></td>
</tr>
<?php 
$row_count++;
}
echo("</table><br>

");
}
?>

Currently is shows as:

1
_________

2
_________

3
_________

4
_________

5
_________

6
_________

I would like it to show like this:

1         | 2
_________ | _________
3         | 4
_________ | _________
5         | 6
_________ | _________
  • 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-24T04:18:10+00:00Added an answer on May 24, 2026 at 4:18 am

    For what it’s worth, I encorporated MarcB’s code into your original code. You were already doing the mod with your row count. I think you want something like this:

    <?php 
    include("config.php");
    include("opendb.php");
    
    $get_cats = mysql_query("SELECT * FROM `categories` ORDER BY `displayorder`") or die(mysql_error());
    $get_info = mysql_query("SELECT * FROM `systeminfo`") or die(mysql_error());
    $info = mysql_fetch_array($get_info);
    while($cats = mysql_fetch_array($get_cats)) {
            $get_rares = mysql_query("SELECT * FROM `rares` WHERE `catid`='".$cats['id']."'") or die(mysql_error());
            echo("<h2>".$cats['name']."</h2><br>
                    <table width=\"100%\" border=\"0\">
                    <tr>
                            <td width=\"20%\" style=\"text-align:center\"><b>Image</b></td>
                            <td width=\"40%\" style=\"text-align:left\"><b>Item Name</b></td>
                            <td width=\"10%\" style=\"text-align:center\"><b>Value</b></td>
                            <td width=\"30%\" style=\"text-align:center\"><b>Last Updated</b></td>
                            <td width=\"20%\" style=\"text-align:center\"><b>Image2</b></td>
                            <td width=\"40%\" style=\"text-align:left\"><b>Item Name2</b></td>
                            <td width=\"10%\" style=\"text-align:center\"><b>Value2</b></td>
                            <td width=\"30%\" style=\"text-align:center\"><b>Last Updated2</b></td>
                    </tr>
                    ");
    
            $color1 = $info[stripe1]; 
            $color2 = $info[stripe2];
    
            $row_count = 0;
    
            while($rare = mysql_fetch_array($get_rares)) {
                    $row_color = ($row_count % 2) ? $color1 : $color2;
                    if ($row_count % 2 == 0) {
                            echo "<tr>"; // if on an 'even' record, start a new row
                    }
    
                    echo "<td width='5%' style='text-align:center;background-color:#$row_color;'><img alt='' src='{$info[imagepath]}{$rare['image']}'></td>
                                    <td width='20%' style='text-align:left;background-color:#$row_color;'>{$rare['name']}</td>
                                    <td width='20%' style='text-align:center;background-color:#$row_color;'>{$rare['value']} Credits</td>
                                    <td width='10%' style='text-align:center;background-color:#$row_color;'>{$rare['lastedited']}</td>";
    
                    if ($row_count % 2 == 0) {
                            echo "</tr>"; // close the row if we're on an even record
                    }
    
                    $row_count++;
            }
    
            echo "</table><br/>";
    }
    

    ?>

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

Sidebar

Related Questions

I wanting to show prices for my products in my online store. I'm currently
I seem to often find myself wanting to store data of more than one
I have been wanting to make a circular preloader in my iPhone app, but
I've got the following url route and i'm wanting to make sure that a
I'm wanting to incorporate HTML5 database storage into my web application to make it
Wanting to make sure I'm using classes properly. The main script accepts this from
I am wanting to make my users life's easier by allowing them to complete
I'm wanting to make an API quickly, following REST principles - for a simple
i want to make a new data structure using arrays for this query it
I'm data-mining information from a website, and one of the things I must do

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.