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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:53:20+00:00 2026-06-15T12:53:20+00:00

I am trying to style my output data, but I do not know how

  • 0

I am trying to style my output data, but I do not know how exactly do this.

My code looks like this:

$Sql99 = "SELECT Cat_Name, Cat_Id, COUNT(Product_Id) AS itemcount FROM tabproducts 
      INNER JOIN tabcats ON tabproducts.Cat_Id = tabcats.Cat_Id  
      GROUP BY tabproducts.Cat_Id ORDER BY itemcount DESC LIMIT 0,4";
$Query99 = mysql_query($Sql99, $Conn);
while($Rs99 = mysql_fetch_array($Query99)){ 

 $cats .= "<li><a href=\"\">".$Rs99["Cat_Name"]."</a></li>"; //this is fine


 $Sql08 = "SELECT tabproducts.*
      FROM tabproducts
      WHERE tabproducts.Cat_Id = '".$Rs99["Cat_Id"]."' ORDER BY Product_Id DESC
      LIMIT 0,5";
$Query08 = mysql_query($Sql08, $Conn) or die(mysql_error());
while($Rs08 = mysql_fetch_array($Query08)){

//OUTPUT

}
 }

My problem is on the second select the information I am try do output should look like this:

      <div>
        <ul class="home-listagem-empresas"> //categorie 1
          <li>
            <h1>".$Rs08["Product_Name"]."</h1>
          </li>
          <li>
            <h1>".$Rs08["Product_Name"]."</h1>
          </li>
        </ul>
      </div>
      <div>
        <ul class="home-listagem-empresas"> //categorie 2
          <li>
            <h1>".$Rs08["Product_Name"]."</h1>
          </li>
          <li>
            <h1>".$Rs08["Product_Name"]."</h1>
          </li>
        </ul>
      </div>
      <div>
        <ul class="home-listagem-empresas"> //categorie 3
          <li>
            <h1>".$Rs08["Product_Name"]."</h1>
          </li>
          <li>
            <h1>".$Rs08["Product_Name"]."</h1>
          </li>
        </ul>
      </div>
      <div>
        <ul class="home-listagem-empresas"> //categorie 4
          <li>
            <h1>".$Rs08["Product_Name"]."</h1>
          </li>
          <li>
            <h1>".$Rs08["Product_Name"]."</h1>
          </li>
        </ul>
      </div>

Each ul with the li‘s will represent the results from the 4 categories.

Sorry if I cannot explain it well, my English is not very good.

  • 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-15T12:53:20+00:00Added an answer on June 15, 2026 at 12:53 pm

    If I understand correctly your problem is that you are unable to present the data in a way that is convenient for you. These types of problems (nested loops) occur a lot in application development and you should probably look into practicing basic algorithms for this. Here are a couple of tutorials to help you out.

    That being said, to obtain the output you desire, you would do this:

    $cats .= "<div><ul class='home-listagem-empresas'>";
    while($Rs08 = mysql_fetch_array($Query08)){
      //OUTPUT
      $cats .= "<li><h1>".$Rs08["Product_Name"]."</h1></li>";
    }
    $cats .= "</ul></div>";
    

    All the best,

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

Sidebar

Related Questions

I know that this question might have been asked like 100 times, but, believe
I'm trying to style some Drupal output. In particular, I'm trying to reference a
I'm trying to style an image with a white border around it like in
I'm trying to style a TreeView using this example and everything was working fine
I'm trying to style a select option list using CSS. I want more padding
I'm trying to style buttons to look like those I ask about in Android
I'm trying to style all <select> elements that are a descendant of a <div>
I am trying to pre-populate data to a token input field. But nothing gets
I am trying to build a help message output for my custom app like
I bet this is a simple question. Im trying to style my xml file

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.