mysql - display sub-menu of parent menu from parent id php -
<?php $page= $objpage-> get_page(); $id = isset($_get['id']); $child= $objpage-> get_child_page($id); ?> <ul class="nav nav-tabs"> <li role="presentation" class="dropdown"> <?php while($row = mysql_fetch_array($page) ) { ?> <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria- expanded="false"> <?php echo $row['title']; ?> <span class="caret"></span> </a> <?php } ?> </li> </ul>
function get_page
:
function get_page($id="") { $sql = "select "; if( !empty($field) ){ $sql .=" title page page_id>1 " ; } else { $sql .= " * page "; } if( !empty($id) ){ $sql .=" page_id=".$id; } else { $sql .=" parent_id= -1"; } $result = mysql_query($sql) or die( mysql_error() ); if( !empty($id) && $result ){ $value = mysql_fetch_array($result) ; return $value; } return $result; }
function get_child_page
:
function get_child_page($id){ $sql = "select * page parent_id= $id"; $result = mysql_query($sql); return $result; }
i got parent menu has parent id -1 want display child menu parent id .. solution ??
Comments
Post a Comment