veritabanından getirilen verilerin css uygulamak için nasıl

1 Cevap php

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

      $con=mysql_connect("localhost","root","");
      $db=mysql_select_db("testt");
    

    >

    Products
  • Cameras
    • Nikon
  • <hr/>  
      <?php
      $con=mysql_connect("localhost","root","");
      $db=mysql_select_db("testt");
      ?>
    
      <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 Cevap

    Sorunu için doğrudan bir çözüm ama neden böyle MVC-ilke etrafında ve arada çalışır CI gibi bir çerçeve kullanıyorsanız sizin görünümünde PHP ve SQL ifadeleri var değil mi?

    Ben bu CI konular üzerinde okumak öneririz:

    Template parser: http://ellislab.com/codeigniter/user_guide/libraries/parser.html
    Database (active record): http://ellislab.com/codeigniter/user_guide/database/active_record.html
    Views: http://ellislab.com/codeigniter/user_guide/general/views.html

    Şu anda kullanmakta olduğunuz CSS nedir?