Jump to content

Database navigation w/ sub-nav (Live link w/ screen shots)


Recommended Posts

http://aich.aiistudentwork.com/students/erinmoll/Ebb+Flow_S/index2.php

 

Hi everyone,

 

I am in school for Interactive Media & Web Design. I have a project due tomorrow and need help getting to the bottom of this issue. Been trying for a while to get this to work. Basically, I have a main navigation and a sub-nav. The sub-nav is to take the user to the work produced by the students of various majors. I have information being pulled from the database.

 

As you can see from clicking though the site, the main navigation works by switching content--Home, About, Contact, Events, Gallery, Staff. However Majors and its sub nav just stay on the home page. I played around with the body_content, majors, global nav, and section pages. Also adjusted the record sets.

 

Does anyone have an idea? I really appreciate it! My prof thought it may be an issue with case sensitivity of around the parameters (What does that mean?), the content switcher, or the record sets to the majors. I used the http://phpcodechecker.com/ and it highlighted something in the syntax. Then, Dreamweaver said that it made it invalid code.  :wtf:

 

Please help. This project is due tomorrow. I wasn't procrastinating, just a noob with PHP, which makes me a bit slow.

 

GLOBAL NAV

 

<div id="nav1">

    <ul>

      <li><a href="index2.php"<?php if ($section == 'home') {echo 'class="current"'; } ?>>Home</a></li>

      <li><a href="index2.php?section=about"<?php if ($section == 'about') {echo 'class="current"'; } ?>>About</a></li>

      <li> <a href="index2.php?section=contact"<?php if ($section == 'contact') {echo 'class="current"'; } ?>>Contact</a></li>

    </ul>

</div>

   

<div id="nav2">

    <ul>

        <li><a href="index2.php?section=majors"<?php if ($section == 'majors') {echo 'class="current"';}?>>Majors</a>

                        <ul >

                                  <li class="med_nav"><a href="index2.php?section=majors&sub=culinary"<?php if ($sub== 'culinary') {echo 'class="current"';}?>>Culinary</a></li>

                                 

                                  <li class="med_nav"><a href="index2.php?section=majors&sub=fashion"<?php if ($sub == 'fashion') {echo 'class="current"';}?>>Fashion</a></li>

                                 

                                  <li class="smaller_nav"><a href="index2.php?section=majors&sub=film"<?php if ($sub == 'film') {echo 'class="current"';}?>>Film</a></li>

                                 

                                  <li class="med_nav"><a href="index2.php?section=majors&sub=graphic"<?php if ($sub == 'graphic') {echo 'class="current"';}?>>Graphic</a></li>

                                  <li class="smaller_nav"><a href="index2.php?section=majors&sub=web"<?php if ($sub == 'web') {echo 'class="current"';}?>>Web</a></li>

                        </ul>

        </li>

            <li><a href="index2.php?section=events"<?php if ($section == 'events') {echo 'class="current"'; } ?>>Events</a></li>

            <li><a href="index2.php?section=gallery"<?php if ($section == 'gallery') {echo 'class="current"'; } ?>>Gallery</a></li>

            <li><a href="index2.php?section=staff"<?php if ($section == 'staff') {echo 'class="current"'; } ?>>Staff</a></li>

    </ul>

</div>

MAJORS

 

<?php require_once('Connections/conn_ebbflow.php'); ?>

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  }

 

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

 

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

}

 

$colname_rs_content = "-1";

if (isset($_GET['sub'])) {

  $colname_rs_content = $_GET['sub'];

}

mysql_select_db($database_conn_ebbflow, $conn_ebbflow);

$query_rs_content = sprintf("SELECT * FROM ef_content WHERE title = 'majors'", GetSQLValueString($colname_rs_content, "text"));

$rs_content = mysql_query($query_rs_content, $conn_ebbflow) or die(mysql_error());

$row_rs_content = mysql_fetch_assoc($rs_content);

$totalRows_rs_content = mysql_num_rows($rs_content);

?>

 

<h1><?php echo $row_rs_content['title']; ?></h1>

<h2><?php echo $row_rs_content['sub-title']; ?></h2>

<div><?php echo $row_rs_content['body_content']; ?></div>

 

<?php

mysql_free_result($rs_content);

?>

 

SECTION

 

<?php require_once('Connections/conn_ebbflow.php'); ?>

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  }

 

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

 

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

}

 

$colname_rs_content = "-1";

if (isset($_GET['section'])) {

  $colname_rs_content = $_GET['section'];

}

mysql_select_db($database_conn_ebbflow, $conn_ebbflow);

$query_rs_content = sprintf("SELECT * FROM ef_content WHERE title = %s", GetSQLValueString($colname_rs_content, "text"));

$rs_content = mysql_query($query_rs_content, $conn_ebbflow) or die(mysql_error());

$row_rs_content = mysql_fetch_assoc($rs_content);

$totalRows_rs_content = mysql_num_rows($rs_content);

?>

 

<h1><?php echo $row_rs_content['title']; ?></h1>

<h2><?php echo $row_rs_content['sub-title']; ?></h2>

<div><?php echo $row_rs_content['body_content']; ?></div>

<?php

 

mysql_free_result($rs_content);

?>

 

 

post-131649-1348240358995_thumb.png

post-131649-13482403590739_thumb.png

post-131649-13482403591431_thumb.png

post-131649-1348240359227_thumb.png

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.