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

The Archive Base Latest Questions

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

Trying to create DIV containers out of a mysql results which each hold chunks

  • 0

Trying to create DIV containers out of a mysql results which each hold chunks of 10.

$balloon_count = the amount of records each div should hold.

$ui = the loop counter.

Functionality is simple, don’t want to a template engine.

Trying to use the MODULUS operator to simplify the div cuts.

Doesn’t work. Any direction is greatly appreciated.


Sample Code

        $ui=1;
        $balloon_holds = 10;

        while($row = mysql_fetch_array($result))
        {            


            if($ui==1||$ui%$balloon_holds != 0)
                {                    
                echo '<div><table style="width:400px;border:2px solid gray;border-style:dashed;"><tr>';
                echo "<td style=\"font-size:small;vertical-align:text-top;\">";
                }


                echo '<input disabled type="checkbox" value="$row[id]"'; $this->ischecked($uid,$row[id]); echo "/>".$row['name'].'<br>'."\r\n";


                if($ui==10||$ui%$balloon_holds != 0){             
                echo '</td></tr></table></div>';                  
                }



            $ui++; 

        }

Sample Expected “HTML” Output

<div><table style="width:400px;border:2px solid gray;border-style:dashed;"><tr>
<td style="font-size:small;vertical-align:text-top;">         
Record1
Record2
Record3
Record4
Record5
Record6
Record7
Record8
Record9
Record10    
</td></tr></table></div>

<div><table style="width:400px;border:2px solid gray;border-style:dashed;"><tr>
<td style="font-size:small;vertical-align:text-top;">         
Record11
Record12
Record13
Record14
Record15
Record16
Record17
Record18
Record19
Record20    
</td></tr></table></div>           
  • 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-18T01:09:15+00:00Added an answer on May 18, 2026 at 1:09 am

    If I understand the question correctly, you want the <div> opener on $ui = 1,11,21,31,… and the </div> closer on 10,20,30,40,…

    If this is correct, your modulus operators should be changed as such:

    if($ui%$balloon_holds == 1)
    {                    
        ...
    }
    
    ...
    
    if($ui%$balloon_holds == 0)
    {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a new div each time a text field contained in
I'm trying to create a <div> with a series of photos which are horizontally
I'm trying to create an element(div) on keyup of the space key (key-code 32).
I'm basically trying to create a 2 column div with a liquid <h1> and
I'm trying to create the illusion of a multiselect dropdown using a div that
I'm trying to create a small html fragment (a div element) consisted of three
I am trying to create a grid like system with div's with content floated
I'm trying to create a dropdown kind of menu.So on clicking on a div
I'm trying to create a standardized show/hide element system, like so: <div class=opener popup_1>Click
I am trying to create a scrollable DIV using the following: <!DOCTYPE html PUBLIC

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.