Hi,

I have a connection to a MySQL database created by dreamweaver that any file I add connects to just one database connection file so I don't have to change the database details for every file ive created.

I have just introduced a menu system and it inserts the below which means I have to now go to any page that menu's on and insert the database details there to. How do I get it to point to my database connection file please?

Code I wan't to change to point to my connection file:

Code:
$this->conn = mysql_connect( 'Mywebserver.com', 'myusername', '3mypassword );
		mysql_select_db( mydatabasename', $this->conn );
And the file path it connects to is:
Code:
<?php require_once('includes/Connections/design_online_connection.php'); ?>
and the code within that page is:

Code:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_design_online_connection = "Mywebserver.com";
$database_design_online_connection = "Mydatabasename";
$username_design_online_connection = "databaseusername";
$password_design_online_connection = "databasepassword";
$design_online_connection = mysql_pconnect($hostname_design_online_connection, $username_design_online_connection, $password_design_online_connection) or trigger_error(mysql_error(),E_USER_ERROR); 
?>
Here is the complete code:

Code:
class MenuBuilder
{
	var $conn;
	var $items = array();
	var $html  = array();
	function MenuBuilder()
	{
		$this->conn = mysql_connect( 'Mywebserver.com', 'myusername', '3mypassword );
		mysql_select_db( mydatabasename', $this->conn );
		
	}
	function fetch_assoc_all( $query_DetailRS1 )
	{
		$result = mysql_query( $query_DetailRS1, $this->conn );
		
		if ( !$result )
			return false;
		$assoc_all = array();
		while( $fetch = mysql_fetch_assoc( $result ) )
			$assoc_all[] = $fetch;
		mysql_free_result( $result );	
		return $assoc_all;
	}
	function get_menu_items()
	{
		$query_DetailRS1 = 'SELECT * FROM menu_item ORDER BY parent_id, position;';
		return $this->fetch_assoc_all( $query_DetailRS1 );
	}
	function get_menu_html( $root_id = 0 )
	{
		$this->html  = array();
		$this->items = $this->get_menu_items();
		foreach ( $this->items as $item )
			$children[$item['parent_id']][] = $item;
				$loop = !empty( $children[$root_id] );
		$parent = $root_id;
		$parent_stack = array();
		$this->html[] = '<ul>';
		while ( $loop && ( ( $option = each( $children[$parent] ) ) || ( $parent > $root_id ) ) )
		{
			if ( $option === false )
			{
				$parent = array_pop( $parent_stack );
				$this->html[] = str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 ) . '</ul>';
				$this->html[] = str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 - 1 ) . '</li>';
			}
			elseif ( !empty( $children[$option['value']['id']] ) )
			{
				$tab = str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 - 1 );
				
				// HTML for menu item containing childrens (open)
				$this->html[] = sprintf(
					'%1$s<li class="has-sub" id="%3$s" style="display:%4$s"><a href="page.php?ID=%2$s">%3$s</a>',
					$tab,   // %1$s = tabulation
					$option['value']['id'],   // %2$s = link (URL)
					$option['value']['title'],   // %3$s = title
					$option['value']['nav_hide']   // %4$s = nav hide
				); 
				$this->html[] = $tab . "\t" . '<ul class="submenu">';
				
				array_push( $parent_stack, $option['value']['parent_id'] );
				$parent = $option['value']['id'];
			}
			else
				// HTML for menu item with no children (aka "leaf") 
				$this->html[] = sprintf(
					'%1$s<li id="%3$s" style="display:%4$s"><a href="page.php?ID=%2$s">%3$s</a></li>',
					str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 - 1 ),   // %1$s = tabulation
					$option['value']['id'],   // %2$s = link (URL)
					$option['value']['title'] ,  // %3$s = title
					$option['value']['nav_hide']   // %4$s = nav hide
				);
		}
		
		// HTML wrapper for the menu (close)
		$this->html[] = '</ul>';
		
		return implode( "\r\n", $this->html );
	}
}
Many thanks
Joe