Sign up for 2 databases.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bluewater_12
Forum Newbie
Posts: 2
Joined: Tue Feb 05, 2008 3:21 am

Sign up for 2 databases.

Post 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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Sign up for 2 databases.

Post 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.
(#10850)
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Sign up for 2 databases.

Post 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.
bluewater_12
Forum Newbie
Posts: 2
Joined: Tue Feb 05, 2008 3:21 am

Re: Sign up for 2 databases.

Post by bluewater_12 »

Thx for the info

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

PM
Post Reply