Results 1 to 2 of 2

Thread: php and mysql navigation problem

  1. #1
    Join Date
    Feb 2008
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default php and mysql navigation problem

    Hey

    Im creating a Content Management System, at the moment the navigation bar on it gets it tabs from the database, there are many departments when the user selects a particular one it will show a menu for that department ok,
    what i want it to do is stop, becasue at the moment when you select a page from the menu, it tries to find the menu for that page i want it to stop at the department stage, i am using a while loop to bring the content back hope this helps you

    Thanks in advance

    this is my code

    -------------------
    <?php # Script 12.3 - index.php
    //this is the main page for the site

    //Set the page title and include the htmle header
    $page_title = 'Content Managment Site';
    include('./includes/header.html');
    include('./includes/submenu.php');

    require_once ('./includes/mysql_connect.php');

    $content_id = (int) $_GET['content_id'];

    if ($content_id > 0){
    isset($_REQUEST['content_id']);
    //$content_categories_id < 5;
    //content
    echo '<div id="page2">';
    //Query the database
    $query = "SELECT u.content_id, title, summary, contents FROM contents AS u, content_associations AS ca, content_categories AS cc WHERE u.content_id = ca.content_id AND u.content_id=$content_id AND $content_id=ca.content_id AND ca.approved = 'Y' ORDER BY cc.content_categories_id DESC";
    $result = mysql_query($query) or die('Error : ' . mysql_error());

    $row = mysql_fetch_array($result, MYSQL_ASSOC);

    $title = $row['title'];
    $summary = $row['summary'];
    $contents = $row['contents'];
    $nav2 .= "<h1>$title</h1> <p><strong>$summary</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_associations AS ca WHERE u.content_id = ca.content_id AND ca.content_categories_id=$content_id AND ca.approved = 'Y' ORDER BY content_categories_id DESC";
    $result = mysql_query($query);

    // create the content list
    echo '<div id="sub-navigation">';
    $nav = '<ul>';
    while($row = mysql_fetch_array($result, MYSQL_NUM))
    {
    list($content_id, $categories) = $row;
    $nav .= "<li><a href=\"$self?content_id=$content_id\">$categories</a></li>\r\n";
    }

    $nav .= '</ul></div>';

    echo $nav;
    echo $nav2;


    } else {

    //$content_categories_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_associations AS ca WHERE u.content_id = ca.content_id AND u.content_id=10";
    $result = mysql_query($query) or die('Error : ' . mysql_error());
    $row = mysql_fetch_array($result, MYSQL_ASSOC);
    $title = $row['title'];
    $summary = $row['summary'];
    $contents = $row['contents'];
    $nav2 .= "<h1>$title</h1> <p><strong>$summary</strong></p> <p>$contents</p>";
    $nav2 .= '</div>';

    $self = $_SERVER['PHP_SELF'];
    $query = "select * from content_categories ";
    $result = mysql_query($query);

    //create the content list
    echo '<div id="sub-navigation">';
    $nav = '<ul>';
    while($row = mysql_fetch_array($result, MYSQL_NUM))
    {
    list($content_id, $categories) = $row;
    $nav .= "<li><a href=\"$self?content_id=$content_id\">$categories</a></li>\r\n";
    }

    $nav .= '</ul></div>';
    echo $nav;
    echo $nav2;
    }

    mysql_close(); // close the connection

    // Include the html footer
    include('./includes/footer.html');
    ?>

  2. #2
    Join Date
    Feb 2008
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Any ideas i need the help .....please

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •