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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:44:13+00:00 2026-06-10T19:44:13+00:00

Using the following code: <table border=1 > <? $item_count=0; $select_SQL=select * from iplay_test; $result=mysql_query($select_SQL,$con);

  • 0

Using the following code:

<table border="1" >
<?
    $item_count=0;  
    $select_SQL="select * from iplay_test";
    $result=mysql_query($select_SQL,$con);
    while($eachRow= mysql_fetch_array($result))
    {   
        if($item_count%3==0)
        {
            echo "<tr><td> 0 </td></tr>";           
        }
        else
        {
            echo "<td> 1</td>";
        }

    $item_count++;
    }

    ?>      
</table>

I am getting the output ,

0
1    1
0
1    1
0
1    1
0
1    1
0
1    1

But I should be getting something like

0 1 1 
0 1 1
0 1 1

What am I missing here?

I am basically doing this to get 3 items displayed per row. The data to be displayed will be from a database. Is there any better solution for this problem?.

  • 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-10T19:44:14+00:00Added an answer on June 10, 2026 at 7:44 pm

    Changing the code as below, solved my problem. Thanks to Jasha

    <table border="1" >
    
        <tr>
        <?
        $item_count=0;
    
        $select_SQL="select * from iplay_test";
        $result=mysql_query($select_SQL,$con);
        while($eachRow= mysql_fetch_array($result))
        {
    
    
        if($item_count%3==0)
        {
            if($item_count==0)
            {
            echo "<td> 0</td>";
            }
            else
            {
            echo "</tr><tr><td> 0 </td>";
            }   
        }
        else
        {
            echo "<td> 1</td>";
    
        }
    
            $item_count++;
        }
    
    ?>  
    
    </tr>   
        </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am using the following code to update my mysql table where both moving50
I'm trying to get the Global Interface Table by using the following code (Delphi):
I' m trying to enable adding/deleting rows to/from table using folowing code: Script: $(document).ready(function()
I am using following code to get bitmap from url. This function is used
Given the following code, how do I left align the table without using float:left
I am using the following Code, to get data from the Database in phpmyadmin,
I am using the following jQuery code to append to my table: $(tbody#order_details).append('<tr>...</tr><tr>...</tr>'); $(tbody#order_details).append('<tr>...</tr><tr>...</tr>');
I have the following code: HTML <table width=30% border=0> <tr> <td colspan=4 align=center> <asp:Label
I can drop a table if it exists using the following code but 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.