Click here to Skip to main content
12,398,000 members (45,792 online)
Rate this:
 
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 22:03pm
Comments
Mohibur Rashid 21-Sep-12 4:36am
   
Well, I believe that same method is applicable as fetching from one database
ambujmalviya 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 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 21-Sep-12 4:53am
   
just like you do for one database.
ambujmalviya 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 31 Oct 2012
Copyright © CodeProject, 1999-2016
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