Flexible Menu Issue

Hi there,

This is my first ever attempt at php scripting. And straight away I have came across an issue.

I wanted to add a flexible menu to my website so that I can add/remove links on the menu bar. I got everything working fine and the menu works perfect with the exception of the following. If you look at www.caddysview.com you will see the menu bar and I have 2 links in it currently - Home and Courses. They both link to the relevant page but the link for Courses continues through out the page and everything from there to the end of the page links to the courses page. I want ONLY the word Courses to link to the courses page. And of course if I add links after courses ie About Us I want the linking to stop with that and not continue throughout the page.

I have two php files - db1config.php

[php]<?php
$host = ‘your_mysql_server’; //it usually is localhost or something like sql.yourdomain.com
$username = ‘your_username’; //this it your username for the database
$database = ‘your_dbname’; //this is the database name
$password = ‘your_password’; //this obviously is your password for the database
?>[/php]

and connect.php

[php]<?php
$connect = mysql_connect($host,$username,$password) or die("Error connecting to Database! " . mysql_error());
mysql_select_db($database , $connect) or die("Cannot select database! " . mysql_error());
?>[/php]

here is my menu php

[php]<?php
$count = 0;
$query =
mysql_query(“SELECT * FROM menu ORDER BY position ASC”) or die(mysql_error());
while ($row = mysql_fetch_object($query))
{
if ($count!=0){echo " | “;}
echo “<a href=”$row->link” alt="$row->name">".$row->name."";
$count++;
}
?>[/php]

Sorry I am not sure what other information I should post here - if you tell me I can grab it for you.

Thanks in advance for your help

Just notice if I put a full stop ( . ) immediately after the courses in the menu bar and put a link to the home page it cancels the php script. However this leaves a full stop showing randomly and ruins the look of the site. would love to know how to stop the script immediately after the word courses in the menu but haven’t as yet found an “end script” thing.

You can use:

[php]exit;[/php]

To stop the script immediately.

Sponsor our Newsletter | Privacy Policy | Terms of Service