Is it possible to connect to different databases on the same

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
qup41
Forum Newbie
Posts: 2
Joined: Wed Jul 16, 2003 6:38 pm
Location: Gold Coast

Is it possible to connect to different databases on the same

Post by qup41 »

Hi All

I am designing my website and i am using php

my page gets content from one db and the nave from another, however my nav doesn't work i get the following error

Cannot redeclare class db_sql

below is the code for my nav
[Admin Edit: Added tags for clarity - please use them around PHP code so that it is easier to read.][/b]

Code: Select all

<?
include("require2.php");
$mydb2 = new DB_infolink;
$thiscatp = $_REQUEST["pageid"];
$query_list = "SELECT DISTINCT category FROM listings where page LIKE '%".$thiscatp."%'";
$mydb2->query("$query_list");
while($mydb2->next_record()) {
?>
<table border=0 cellspacing=0 cellpadding=0 width="100%">
   <tr>
      <? printf("<td>
      <img height=7 width=18 src="../assets/images/cat_dots.gif" vspace=0 hspace=0 align="MIDDLE" border=0 alt="adelaide %s"></font><a href="listings.php?cat=%s" class="menu"><font COLOR="#808080" size="-2" face="Tahoma,Verdana,Arial,Helvetica,Sans-serif,sans-serif">%s</font></a>
      </td>", $mydb2->f("category"), $mydb2->f("category"), $mydb2->f("category")); ?>
   </tr>
</table>
<? } ?>
Thanks
Armando
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You are including the class definition more than once or have two classes with the same name. If the class is in require2.php, do you include that file anywhere else within the same page?

Mac
Post Reply