working with 2 databases

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
mshperling770
Forum Newbie
Posts: 1
Joined: Sat Dec 18, 2010 2:18 pm

working with 2 databases

Post by mshperling770 »

B"H

hello everyone! in the project i am working on on some pages i need to take data from one database and sometimes from another so i have some flag variable that switches between them. The problem starts that there are certain places i need to retrieve data from 2 databases to the same page.

i've given link-identifier for every connection:

Code: Select all

$hebdb = mysql_connect("localhost","user","pass",true);

Code: Select all

$link = mysql_connect("localhost","user","pass",true);
and every time i use mysql_query i put this link:

Code: Select all

$rItemsCount = mysql_query($qItemsCount,$hebdb);
in but it tells me:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in...

any help would be very much appriciated. Thanks. :?
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: working with 2 databases

Post by Apollo »

Did you select a database for either connection? (using mysql_select_db)
Post Reply