Page 1 of 1

Sign up for 2 databases.

Posted: Tue Feb 05, 2008 4:38 am
by bluewater_12
Hi all

Is it possible to have a single "Sign up" php script write to 2 seperate mysql databases in the one process.

I am looking to buy 2 php programmes that have their own database setup which will be hosted under a single domain (http://www.mysite.com).

Can i rewrite the script in one programme to match the database name and table/fields of the other for the user sign ups and logins as i am trying to have a user sign up on one program and have their user details accessible by the other (for login only purposes). (I think sessions are another issue)

The two programs will be graphically design so they look like one "website" but the user will have to login to each "section" of the site seperately.

I am looking for the most simple solution at this stage as i continue to learn more about PHP and hopefully intergate the 2 programmes better.

Hope this makes sense :?

Thx PM

Re: Sign up for 2 databases.

Posted: Tue Feb 05, 2008 5:29 am
by Christopher
You may need to update both databases when you manage users accounts. But to do a single sign-in you probably need to set session variables so that each program allows access to authenticated users.

Re: Sign up for 2 databases.

Posted: Tue Feb 05, 2008 1:10 pm
by califdon
I'm interpreting the OP's question a bit differently. If you are asking whether you can access more than one database within the same PHP script, the answer is Yes. Naturally, you need to know the host, username and password for each one. Then you can either access them sequentially, or you can create a separate $connection object for each one and use the appropriate one when you send queries.

Re: Sign up for 2 databases.

Posted: Wed Feb 06, 2008 1:52 am
by bluewater_12
Thx for the info

Now it time to go and make an omelette. 8O

PM