i want to link 3 database in one page but there is error occured
Table 'test.main_info' doesn't exist
HELP me
coding is
$host='localhost';
$user='root';
$pass='';
$db1='test';
$db3='test2';
$connection=mysql_connect($host,$user, $pass);
$db=mysql_select_db($db3, $connection);
$db1=mysql_select_db($db1, $connection);
$query=mysql_query("select * from testid") or die(mysql_error());
$query1=mysql_query("select * from main_info") or die(mysql_error());
database
Moderator: General Moderators
-
prasadharischandra
- Forum Commoner
- Posts: 57
- Joined: Thu May 09, 2002 2:19 am
- Location: sri lanka
- Contact:
take a look at the mysql_select_db reference
the return type is a boolean. There is only one current database for one connection.
But you can do a cross-database-join if you need the data simultaneous in a query.
i.e.: SELECT db1.tbl1.f1 as fA, db2.tbl2.f2 as fB from db1.tbl1, db2.tbl2 WHERE db1.tbl1.f1 > db2.tbl2.f2
the return type is a boolean. There is only one current database for one connection.
But you can do a cross-database-join if you need the data simultaneous in a query.
i.e.: SELECT db1.tbl1.f1 as fA, db2.tbl2.f2 as fB from db1.tbl1, db2.tbl2 WHERE db1.tbl1.f1 > db2.tbl2.f2
This might work:
-c.w.collins
Code: Select all
$db=mysql_select_db($db3, $connection);
$query=mysql_query("select * from testid") or die(mysql_error());
$db=mysql_select_db($db1, $connection);
$query1=mysql_query("select * from main_info") or die(mysql_error());How about iframe?
would it be possible to show results of two databases on "one"
page within iframes?
page within iframes?
Re: How about iframe?
i don't see why not... you may have to use a little javascript to do it, but i'm sure it's possible.