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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:33:55+00:00 2026-06-13T08:33:55+00:00

Morning, We have a script for spliting the data we get from a mysql

  • 0

Morning,

We have a script for spliting the data we get from a mysql database (based on this answer: https://stackoverflow.com/a/8660624/1067100) in a table with three columns, in the case of the current example, we have a database that returns 8 values ​​but appear 9 (latter completely empty).

The current image can clarify the problem if it has become abundantly clear, and also a link to the code we think is wrong. We have reviewed but we are not able to find out what the problem.. :/

the code: https://gist.github.com/99df1288cd1d998c8172

enter image description here

Thanks in advance.

  • 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-13T08:33:57+00:00Added an answer on June 13, 2026 at 8:33 am

    The queickest fix is that you need a “break” in the inner loop.

    for ($i=0; $i < count($data)/3; $i++){
        for ($j=0; $j<3; $j++){
             if (($i * 3) + $j >= count($data)) {
                 break;
             }
    

    Note that you should save a fractional bit of computing power by storing count($data) in a variable – unless you expect the count to change.

    $countOfData = count($data);
    for ($i=0; $i < $countOfData/3; $i++){
        for ($j=0; $j<3; $j++){
             if (($i * 3) + $j >= $countOfData) {
                 break;
             }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good Morning, I have copied this code from somewere <script type=text/javascript> $(function() { setInterval(rotateImages(),
I followed the Google Apps Script JDBC example shown at https://developers.google.com/apps-script/jdbc but have been
I have been dabbling around this morning trying to modify the jQuery cycle script
I have a test server that uses data from a test database. When I'm
I have a massive amount of data that needs to be read from mysql,
I have made some progress with the DataList and UserControl this morning but I
Morning stackoverflow, I have a repeater, with the following code in my aspx page;
Good morning, I have mysql queries where I would like to calculate percentage of
Morning all, I have a php script which I have been testing, and seems
Morning all, Theres a few questions around this but none that really answer 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.