473,545 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Navigation bar PHP and MYSQL

1 New Member
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
Mar 7 '08 #1
2 2675
Markus
6,050 Recognized Expert Expert
I don't understand, really.
Do you have a link?
And you need to use code tags when posting code.
Mar 8 '08 #2
ronverdonk
4,258 Recognized Expert Specialist
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
Mar 8 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1752
by: Xeon | last post by:
Hi, I got a set of pages which must be navigated in a strict manner. Let's just say the pages are named A, B, C, and so on. I got no problem with forward navigation, but I want to disable the client browser's back button. More specifically, if the user is currently at page D, the back button doesn't bring the user to page C, but page A...
0
2114
by: Veli-Pekka Tätilä | last post by:
Hi, My first post here. I've found some serious accessibility flaws in the Python 2.4 docs and wish they could be rectified over time. I'm very new to Python and initially contacted docs at python org, However, I haven't gotten a reply for a week or so, and figured out I could post here for a larger audience, then. Original message...
2
9565
by: Kapil Jain | last post by:
Dear All, I would like to disable back and forward button + Refresh button. Please help in doing this. I want this because i am displaying data from mysql database and on back and forward button complete logic get failed. Also i would like disable save as option + copy & select all option. Please urgently help me.
1
1511
by: Tony Wainwright | last post by:
Hi I have seen on numerous websites a navigation sidebar, where you click a link which expands and shows related links underneath as in - Main Topic 1 Subtopic Subtopic + Main Topic 2 + Main Topic 3 Is this sort of thing possible in PHP? I am quite new to web programming but
10
2519
by: EA | last post by:
I am sure I must be missing something about building navigation bars with CSS. Yes it is a very clever and efficient way to format navigation structures on simple one navigation level webs, i.e. six buttons which when clicked go to a separate web page. But here is where I must be missing something, am I right in thinking that if you wish...
0
913
by: darr | last post by:
i am using vb2005 and mysql to create an interface and database. I have already connected to the Mysql database via .NET connector and i am now able to bind data into text boxes. However when i try to create navigation buttons 'next' 'first' 'last' and 'previous' i am not getting it to work. Here is the code that i used for the next button and...
1
1583
by: Dave | last post by:
Hello, I'm working on a new site and i'd like to have a navigation menu on it. Ideally i'm thinking: home first item second item etc obviously with different names. I could use echo to output each line, but i
3
1991
by: beary | last post by:
Does anyone know whether it's possible to make a drop down navigation menu using php and mysql but no css?
3
4121
by: Justino | last post by:
Hi, I'm trying to integrate breadcrumb based navigation on my site, but have hit a wall. I have an array that pulls from a MySQL data tree (hierarchical) based on a variable passed in the url. http://www.mysite.com?category=apples will output food fruit > apples. I have everything working but instead of passing the string in the url I'd...
0
7487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7420
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5349
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3476
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
731
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.