access my other database

pathway

Joined: 2004-07-22
Posts: 11
Posted: Sat, 2008-09-27 09:22

Hello,

I want to have a dynamic top menu and some other content in my gallery2, so I need to access another two databases.
Can I make a connection to those databases?

Thank you in advance,

John

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2008-09-27 15:54
Quote:
I want to have a dynamic top menu and some other content in my gallery2

just add your code to the template file you want it to show up on. There is a couple of 3rd party modules that provide ways to add content/links to the template.

Quote:
Can I make a connection to those databases?

Yes.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
pathway

Joined: 2004-07-22
Posts: 11
Posted: Sat, 2008-09-27 17:19

Hi Dave,

I tried to add the following:

{php}$link = mysql_connect (localhost, username, pass) or mydie ('I cannot connect to the database.');{/php}
{php}mysql_select_db (my_other_db,$link) or mydie(mysql_error(),"Error opening DB on jump");{/php}

in the head section of theme.tpl but i get a blank page. It seems that it can not go below that.

Any ideas?

Thank you

John

 
pathway

Joined: 2004-07-22
Posts: 11
Posted: Sun, 2008-09-28 18:50

Hi Dave,

I placed the code below inside a table in g2-page div

{php}$link = mysql_connect (localhost, username, pass) or mydie ('I cannot connect to the database.');{/php}
{php}mysql_select_db (my_other_db,$link) or mydie(mysql_error(),"Error opening DB on jump");{/php}

and i think it works now.

Thank you

John