473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

using 2 or 3 Databases in PHP!!!

11
i'm having this project where i need to be connected to more than 1 database > i've used php before so any redirection to articles or tutorial would be helpful.

thnx for your time
Feb 13 '08 #1
5 1154
Hi,

You can just use the query in this way,

mysql_query = "SELECT * FROM database1.table1,database2.table2,database3.table3 WHERE id='1'";

With regards
Feb 13 '08 #2
Tara83
11
thnx for your reply

what about the config file? i still need a new statment to connect to 2 DB
Feb 13 '08 #3
ronverdonk
4,258 Expert 4TB
thnx for your reply

what about the config file? i still need a new statment to connect to 2 DB
See the following entry in the mysql_select_db chapter of the PHP manual
at multiple dbs
Just incase the mysql_select_db() function still won't work with multiple database connections (as has happened to me before).

$dbh1 = mysql_pconnect($host,$user,$pass);
$dbh2 = mysql_pconnect($host,$user,$pass);

You could do this...

mysql_query("USE database1",$dbh1);
mysql_query("Use database2",$dbh2);

This does the same thing as the mysql_select_db() function...

or this...

You don't even have to select the database for each connection.

mysql_query("SELECT * FROM database1.table",$dbh1);
mysql_query("SELECT * FROM database2.table",$dbh2);
Ronald
Feb 13 '08 #4
Tara83
11
appreciate your fast help ronverdonk
thnx alot
Feb 13 '08 #5
ronverdonk
4,258 Expert 4TB
appreciate your fast help ronverdonk
thnx alot
You are welcome. See ya again.

Ronald
Feb 13 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Michael J. Astrauskas | last post by:
I have a script, which I've called test-loadpic.php and some pages reference it by means of <img src="test-loadpic.php?sourcepic=$picNum"> where $picNum stores a number. This part itself works...
1
by: Dynamo | last post by:
Not sure if this is the right group for this question but here goes anyway. Does using index.php instead of index.htm affect the way that your site is crawled by major search engines? Reason I...
2
by: Ben Chivers | last post by:
I have a problem, which I think can be easily solved somehow. I am trying to execute a C program through using a PHP script. I do this by sending an exec command from the PHP script. My PHP...
2
by: Paul Aspinall | last post by:
Hi I know that SQL Server 2005 can allow for simple deployment with .NET 2.0 applications. Does anyone know where there is a simple tutorial, on how to attach your ..mdf DB files to the SQL...
2
by: John Dann | last post by:
Apologies if this isn't the best group - maybe someone can suggest a more appropriate one - I can't immediately see anything on ado.net. I need to store a significant amount of data (say 1-10MB)...
3
by: Susan Baker | last post by:
I cant seem to locate any tutorials/references on using C# (clientside) and PHP on the server side. Anyone done this before?. Any useful books/sites recommended will be much appreciated.
6
by: Petr Jakes | last post by:
I would like to know if anybody can point me to the site, where it is possible to find the tutorial "Using Databases in Python" which is mentioned by Steve Holden here: http://tinyurl.com/ectj8 ...
4
by: Chuck Anderson | last post by:
My Web Host (Linux - Apache) recently upgraded to Php5. One thing lost in the upgrade was a global configuration that allowed me to place php.ini files in any directory and they would be read and...
11
by: jschofield | last post by:
Hello all. Not sure if this is the correct place to ask this but I am new to php and I am building a script to remove certain columns in a comma delimited file plus other things. My problem is...
2
by: webfreak | last post by:
hello am a relative newbie to php. am using dreamweaver,php/mysql. i want to populate a mysql field using a multiple selection list menu. i have been to countless forums and so far nothing. can...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.