How To Make A Dynamic Php Menu With Data From Mysql Database?

Discussion in 'PHP' started by ritwick123, Feb 7, 2013.

  1. #1
    I want to create a menu which looks like this - http://i.imgur.com/R2Av6G7.png[​IMG]
    So i have two menus that will fetch data from a mysql database tables. Say the database name is "homedb" and the name of the tables are "social" and "news" etc. Now i wish to make a menu where the left menu will show database on it's right side and the right hand side menu button will show database items on it's left side. Now how do i do it and show data from tables from database ? Do i need css and would it help me ?
    This is a major project and i'm stuck here so i'd greatly appreciate any help i get here. This is the final problem i have here and i wish developers here would assist me. Thanks.
     
    ritwick123, Feb 7, 2013 IP
  2. SedNaX

    SedNaX Active Member

    Messages:
    1,326
    Likes Received:
    59
    Best Answers:
    0
    Trophy Points:
    90
    #2
    You almost always create menus using a unordered list (<ul>). Use css rules to create a nice menu. If you Google "css menu examples" you'll find a million tutorials. Then use the database to do something like this:

    <ul>
    <?foreach ($db_result as $item){?>
      <li><a href="<?=$item->url?>"><?=$item->name?></a></li>
    <?}?>
    </ul>
    
    Code (markup):
    In English: each row in the db gets its own <li>..</li>. Good luck!
     
    SedNaX, Feb 9, 2013 IP