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

The Archive Base Latest Questions

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

I am fetching the datas from the database…And the datas are displayed as dropdownmenu

  • 0

I am fetching the datas from the database…And the datas are displayed as dropdownmenu but the css is not applied


  <ul id="nav">
  <?php
  $res=mysql_query("SELECT * FROM menu WHERE PARENT_ID=0");
  while($row=mysql_fetch_array($res))
  {
        echo "<li class='top'><a href='#' class='top_link'>".$row['MENU_NAME']."</a></li>";
    $res1=mysql_query("SELECT * FROM menu WHERE PARENT_ID=1 AND CHILD_ID=".$row['ID']."");

        while($row1=mysql_fetch_array($res1))
          {

             echo "<ul  class='sub'><li class='top'><a href='#' >".$row1['MENU_NAME']."</li></ul>";
             $res2=mysql_query("SELECT * FROM menu WHERE PARENT_ID=2 AND CHILD_ID=".$row1['ID']."");
             echo "<ul>";
             while($row2=mysql_fetch_array($res2))
                {
                        echo "<ul><li class='fly'><a href='#'>".$row2['MENU_NAME']."</li></ul>";
                }
             echo "</ul>";
          }
          echo "</ul>";
  }





  ?>
  </ul>
  <h1> </h1>


  <hr/>

this is my view page
my datas must be arranged in such a order that datas in the class=’top’ must be arrrived as as the main menu
the datas in the class=”sub” must be arrivd as submenu
the datas in the class=”fly” must be arrived as sub menu to the submenu
The format is
->main menu
-> submenu1->submenu11
->submenu12

-> submenu2
-> submenu3
when i give hard coded datas i am receiving in order that when i hover main menu
submenu will be displayed ..
the hard coded code is

Products

  • Cameras
    • Nikon
  • when i hover submenu.. A submenu of the sub menu is be displayed
    I got these results
    How can apply the css to the datas fetchded from th database
    my whole view page is

    stu nicholls dot com | menu – Professional dropdown #2

    Products

  • Cameras
    • Nikon

  •   <ul id="nav">
      <?php
      $res=mysql_query("SELECT * FROM menu WHERE PARENT_ID=0");
      while($row=mysql_fetch_array($res))
      {
            echo "<li class='top'><a href='#' class='top_link'>".$row['MENU_NAME']."</a></li>";
        $res1=mysql_query("SELECT * FROM menu WHERE PARENT_ID=1 AND CHILD_ID=".$row['ID']."");
    
            while($row1=mysql_fetch_array($res1))
              {
    
                 echo "<ul  class='sub'><li class='top'><a href='#' >".$row1['MENU_NAME']."</li></ul>";
                 $res2=mysql_query("SELECT * FROM menu WHERE PARENT_ID=2 AND CHILD_ID=".$row1['ID']."");
                 echo "<ul>";
                 while($row2=mysql_fetch_array($res2))
                    {
                            echo "<ul><li class='fly'><a href='#'>".$row2['MENU_NAME']."</li></ul>";
                    }
                 echo "</ul>";
              }
              echo "</ul>";
      }
    
    
    
    
    
      ?>
      </ul>
      <h1> </h1>
    
    
      <hr/>
    

    Can anyone give me suggestion

    • 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-13T23:09:00+00:00Added an answer on May 13, 2026 at 11:09 pm

      Not directly a solution for your problem but why are you using a framework such as CI, which works around the MVC-principle and in the meantime have PHP and SQL statements in your view?

      I suggest you read up on these CI topics:

      • Template parser:
        https://www.codeigniter.com/userguide2/libraries/parser.html
      • Database (active record):
        https://www.codeigniter.com/userguide2/database/active_record.html
      • Views: https://www.codeigniter.com/userguide2/general/views.html

      What’s the CSS you’re currently using?

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

    Sidebar

    Related Questions

    Hi onListItemClick for listview is not working. Here i am fetching datas from SQLite
    I'm finding that JPA is not fetching the latest data from the database. My
    hi everyone i am fetching some data from a database using php, encoding it
    I am fetching the data from a database and I am appending it to
    I am fetching data from mysql to a page, i am not sure if
    This is my php script for fetching data from a db. <?php mysql_connect(host,user,pass); mysql_select_db(db);
    I'm fetching some data from an MSSQL table using the mssql_fetch_object, but the text
    I'm fetching data from external database (I cannot edit it so don't suggest that
    I want to create a dynamic (fetching data from the database) XML sitemap which
    I can't get nl2br function to work after fetching data from my database: $result

    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.