Click here to Skip to main content
11,431,373 members (67,680 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP MySQL
Dear friends

i want to fetch the value on same page from two different database on the same server with different username and password for database,how can i do that..?
Posted 20-Sep-12 23:03pm
Comments
Mohibur Rashid at 21-Sep-12 4:36am
   
Well, I believe that same method is applicable as fetching from one database
ambujmalviya at 21-Sep-12 5:09am
   
i can do same as for one database but problem is that on my page where i already fetch value from four different table. and when i want to add this database then my some table are not working properly.so i facing problem in display.
Mohibur Rashid at 21-Sep-12 5:13am
   
Working properly does not make sense. Show us the query. and also show us what data you expect and what result you are getting
gladiatron at 21-Sep-12 4:53am
   
just like you do for one database.
ambujmalviya at 21-Sep-12 5:09am
   
i can do same as for one database but problem is that on my page where i already fetch value from four different table. and when i want to add this database then my some table are not working properly.so i facing problem in display.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi there,
If the two databases from which you want to get values from are on two different DB instances (on the same server), then you need to script a database connection string that uses each instance’s PORT number.
If the two databases are located on the same DB instance, then you need to use the database name to gain access to the database.
Hope this helps Smile | :)
Diana
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

SELECT * FROM databaseA.schema.table
SELECT * FROM databaseB.schema.table
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.150428.2 | Last Updated 31 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100