Navigation bar PHP and MYSQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 1kky
    New Member
    • Mar 2008
    • 1

    Navigation bar PHP and MYSQL

    Hi all,

    i have a big problem with my navigation bar..
    the thing is i can get all of the work apart from when you click a department name you go inside that department you can see the tabs but when you select on the last item in the list it displays the content but the navigation bar disappears

    i want the menu to basically only change the first time the user goes into the department not when they are in there ... is that clear
    [php]this my code for the navigation so far
    $content_catego ries_id = $_REQUEST['content_catego ries_id'];
    if ($content_categ ories_id > 0){
    //isset($_REQUEST['categories']);
    //$content_catego ries_id < 5;
    //content
    echo '<div id="page2">';
    //Query the database
    $query = "SELECT u.content_id, title, summary, contents FROM contents AS u, content_associa tions AS ca WHERE u.content_id = ca.content_id AND u.content_id=$c ontent_categori es_id AND ca.approved = 'Y' ORDER BY content_categor ies_id DESC";
    $result = mysql_query($qu ery) or die('Error : ' . mysql_error());
    $row = mysql_fetch_arr ay($result, MYSQL_ASSOC);
    $title = $row['title'];
    $summary = $row['summary'];
    $contents = $row['contents'];
    $nav2 .= "<h1>$title </h1> <p><strong>$sum mary</strong></p> <p>$contents</p>";
    $nav2 .= '</div>';
    //navigation
    $self = $_SERVER['PHP_SELF'];
    //$query = "SELECT u.content_id, title, summary, contents FROM contents AS u, content_associa tions AS ca WHERE u.content_id = ca.content_id AND ca.content_cate gories_id=$cont ent_categories_ id AND ca.approved = 'Y' ORDER BY ca.content_cate gories_id DESC";
    $query = "SELECT u.content_id, title, summary, contents FROM contents AS u, content_associa tions AS ca WHERE u.content_id = ca.content_id AND ca.content_cate gories_id=$cont ent_categories_ id AND ca.approved = 'Y' ORDER BY ca.content_cate gories_id DESC";
    $result = mysql_query($qu ery);
    // create the content list
    echo '<div id="sub-navigation">';
    $nav = '<ul>';
    while($row = mysql_fetch_arr ay($result, MYSQL_NUM))
    {
    list($content_c ategories_id, $categories) = $row;
    $nav .= "<li><a href=\"$self?co ntent_categorie s_id=$content_c ategories_id\"> $categories</a></li>\r\n";
    }

    $nav .= '</ul></div>';
    echo $nav;
    echo $nav2;
    } else {
    //$content_catego ries_id = 0;
    // this will display the front page
    echo '<div id="page2">';
    $query = "SELECT u.content_id, title, summary, contents FROM contents AS u, content_associa tions AS ca WHERE u.content_id = ca.content_id AND u.content_id=10 ";
    $result = mysql_query($qu ery) or die('Error : ' . mysql_error());
    $row = mysql_fetch_arr ay($result, MYSQL_ASSOC);
    $title = $row['title'];
    $summary = $row['summary'];
    $contents = $row['contents'];
    $nav2 .= "<h1>$title </h1> <p><strong>$sum mary</strong></p> <p>$contents</p>";
    $nav2 .= '</div>';
    $self = $_SERVER['PHP_SELF'];
    $query = "select * from content_categor ies ";
    $result = mysql_query($qu ery);
    //create the content list
    echo '<div id="sub-navigation">';
    $nav = '<ul>';
    while($row = mysql_fetch_arr ay($result, MYSQL_NUM))
    {
    list($content_c ategories_id, $categories) = $row;
    $nav .= "<li><a href=\"$self?co ntent_categorie s_id=$content_c ategories_id\"> $categories</a></li>\r\n";
    }
    $nav .= '</ul></div>';
    echo $nav;
    echo $nav2;
    }[/php]

    Please enclose any code within the proper code tags. See the Posting Guidelines on how to do that. - moderator
    Last edited by ronverdonk; Mar 8 '08, 01:38 PM. Reason: code within tags
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    I don't understand, really.
    Do you have a link?
    And you need to use code tags when posting code.

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      No that is not clear at all. First see the Posting Guidelines, of which the following is an excerpt;
      Give as much detail as possible

      When you post a question or problem, express the situation clearly and concisely and include all relevant information, code used, data used, result expected, result achieved and any error codes or messages that you get as a result.

      Use Clear English to write your question in if possible, try to avoid using abbreviations

      Do not use leet speak or text speak, they are not Clear English
      Ronald

      Comment

      Working...