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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:59:30+00:00 2026-05-22T23:59:30+00:00

all i want to do is end the current, and begin a new UL

  • 0

all i want to do is end the current, and begin a new UL every 10 results

heres my code which isn’t working 100%:

    $sql1 = mysql_query("select * from `provinces` order by `name` asc");

    while ($row1 = mysql_fetch_assoc($sql1))
    {
        echo '<li id="popup_'.strtolower(str_replace(' ', '_', $row1['name'])).'">';
        echo '<ul>';

        $sql2 = mysql_query("select * from `cities` where `id_province`='".$row1['id']."' order by `name` asc");
        $count = 1;

        while ($row2 = mysql_fetch_assoc($sql2))
        {
            if ($count % 10 == 0)
                echo '</ul>';

            echo '<li>'.$row2['name'].'</li>';

            if ($count % 10 == 0)
                echo '<ul>';

            $count++;
        }

        echo '</ul>';
        echo '</li>';
    }
  • 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-22T23:59:31+00:00Added an answer on May 22, 2026 at 11:59 pm

    replace this

    if ($count % 10 == 0)
           echo '</ul>';
    

    with

        if ($count % 10 == 0)
                echo '</ul><ul>';
    

    And completly remove the second check

            if ($count % 10 == 0)
                echo '<ul>';
    

    Otherwise your html screws up

    // took me some time to get this answered because the problem was not easy to indentify 🙂

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

Sidebar

Related Questions

I have a website with friendly urls. I want all url´s that end with
I want to trim trailing whitespace at the end of all XHTML paragraphs. I
Hi i want to compare all the values of 2 arrays and end up
I want to drop all the SQL Agent Jobs which are not currently running
All I want is to be able to change the color of a bullet
All I want is to update an ListViewItem's text whithout seeing any flickering. This
All I want is a pragmatic random number generator in C# so I can
All I want is to get the website URL. Not the URL as taken
All I want is a one pixel black border around my white UILabel text.
All I want to know is if there's an easy way to add lines

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.