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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:35:22+00:00 2026-05-28T03:35:22+00:00

I originally had a lightbox that once opened simply fetched all brands from a

  • 0

I originally had a lightbox that once opened simply fetched all brands from a database which were in a list. The problem is that this list can be quite long so I split the brands out into lists of 10 and floated them left so that they filled the lightbox horizontally rather than vertically since there are around 40 brands.

The initial problem with my code is that it won’t cover if suddenly, another 10 brands are added to the database since my code doesn’t account for them.

The other problems are that I feel disgusted with myself having used multiple queries so I was wondering if anyone could offer any pointers about how to achieve the below with a bit more elegance and efficiency:

$sql2 = "SELECT page_id, name, url
             FROM " . DBTABLE_SITEMAP ."
             WHERE parent_id=$frames
             AND isActive=1
             AND isDeleted=0
             ORDER BY position ASC
             LIMIT 10";

$result2 = mysql_query($sql2, $db_conn);

if (mysql_num_rows($result2) > 0) {
    echo '<ol class="subnav-glasses">';

    while ($myrow2 = mysql_fetch_array($result2)) {
        $this_sub_page_id   = $myrow2["page_id"];
        $this_sub_name      = htmlentities($myrow2["name"]);
        $this_sub_url       = $myrow2["url"];


        echo "\n<li><a href=\"$this_sub_url\" title=\"$this_sub_name\">$this_sub_name</a>";                                
        echo '</li>';
    }
    echo "</ol>";
}


$sql3 = "SELECT page_id, name, url
             FROM " . DBTABLE_SITEMAP ."
             WHERE parent_id=$sitemap_designer_frames
             AND isActive=1
             AND isDeleted=0
             ORDER BY position ASC
             LIMIT 10
             OFFSET 10";

$result3 = mysql_query($sql3, $db_conn);

if (mysql_num_rows($result3) > 0) {
    echo '<ol class="subnav-glasses">';

    while ($myrow3 = mysql_fetch_array($result3)) {
        $this_sub_page_id   = $myrow3["page_id"];
        $this_sub_name      = htmlentities($myrow3["name"]);
        $this_sub_url       = $myrow3["url"];


        echo "\n<li><a href=\"$this_sub_url\" title=\"$this_sub_name\">$this_sub_name</a>";                                
        echo '</li>';
    }
    echo "</ol>";
}


$sql4 = "SELECT page_id, name, url
             FROM " . DBTABLE_SITEMAP ."
             WHERE parent_id=$sitemap_designer_frames
             AND isActive=1
             AND isDeleted=0
             ORDER BY position ASC
             LIMIT 10
             OFFSET 20";

$result4 = mysql_query($sql4, $db_conn);

if (mysql_num_rows($result4) > 0) {
    echo '<ol class="subnav-glasses">';

    while ($myrow4 = mysql_fetch_array($result4)) {
        $this_sub_page_id   = $myrow4["page_id"];
        $this_sub_name      = htmlentities($myrow4["name"]);
        $this_sub_url       = $myrow4["url"];


        echo "\n<li><a href=\"$this_sub_url\" title=\"$this_sub_name\">$this_sub_name</a>";                                
        echo '</li>';
    }
    echo "</ol>";
}


    $sql5 = "SELECT page_id, name, url
             FROM " . DBTABLE_SITEMAP ."
             WHERE parent_id=$sitemap_designer_frames
             AND isActive=1
             AND isDeleted=0
             ORDER BY position ASC
             LIMIT 10
             OFFSET 30";

$result5 = mysql_query($sql5, $db_conn);

if (mysql_num_rows($result5) > 0) {
    echo '<ol class="subnav-glasses">';

    while ($myrow5 = mysql_fetch_array($result5)) {
        $this_sub_page_id   = $myrow5["page_id"];
        $this_sub_name      = htmlentities($myrow5["name"]);
        $this_sub_url       = $myrow5["url"];


        echo "\n<li><a href=\"$this_sub_url\" title=\"$this_sub_name\">$this_sub_name</a>";                                
        echo '</li>';
    }
    echo "</ol>";
}
  • 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-28T03:35:23+00:00Added an answer on May 28, 2026 at 3:35 am

    Some pseudo-code for you:

    $sql2 = "SELECT page_id, name, url
             FROM " . DBTABLE_SITEMAP ."
             WHERE parent_id=$frames
             AND isActive=1
             AND isDeleted=0
             ORDER BY position ASC";
    
    $result2 = mysql_query($sql2, $db_conn);
    
    $i=0;
    while ($myrow = mysql_fetch_array($result2))
    {
      if ($i % 10 === 0)
      {
         if ($i > 0)
           echo "</ol>";
    
         echo "<ol>";
      }
    
      echo "<li>dsoajda</li>";
    
      $i++;
    }
    
    if ($i > 0)
      echo "</ol>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem: I originally had a query that was working great but I'm now having
I originally had an array[1..1000] that was defined as a global variable. But now
A co-worker asked about some code like this that originally had templates in it.
Originally I had a design problem where I needed five subclasses of a superclass,
I originally had this code which I mistakenly thought would do what I wanted
All, I originally had my setup like this and everything worked as expected. WEB-INF
I'm not sure how to do this. So I originally had a ViewController that
I'm using System.Net.Mail.MailMessage to send emails from my C# Windows app. I originally had
I originally had a function that uses pow(), and I noticed it was returning
I originally had a code segment that iterated through rows of an Excel spreadsheet

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.