Reputation: 3651
Ok, I am looking to use php to access two databases.
The form posts into database 1 (person), while I have in the form two drop down menus that access a second database named (pulldown) to populate themselves.
So it would look like this.
Now I know to access one database you need to enter in
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME)
How does it work when you need to access two of them?
Now the pull down code isn't an issue, but it is when it is inserted into a form like what I want, how I want to do it, it is.
Can anyone here help?
So what I want is to have access to person and pulldown at the same time, even though data is being pulled from pulldown and entered into person.
Does this make any sense?
Upvotes: 1
Views: 225
Reputation: 6718
$dbc1 = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME1);
$dbc2 = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME2);
// ... some code ...
mysqli_query($dbc1,$query1);
mysqli_query($dbc2,$query2);
Upvotes: 1