Jump to content


Photo

inserting 1 thing into 2 databases?


  • Please log in to reply
9 replies to this topic

#1 Detail

Detail

    King Detail

  • Hosted
  • 7,767 posts
  • Location:Dayonic
  • Projects:Dayvi.com
  •  Blu Spy

Posted 22 November 2005 - 08:04 PM

If i have 2 databases:

FinalLife
SovietCity

and i want a member to be added to both when they register, how do i do it?

#2 Hostile

Hostile

    Benefitting Humanity Simply by Showing Up!

  • Veterans
  • 9,551 posts
  • Location:Washington DC
  •  T3A Founder
  • Division:Revora
  • Job:Global Administrator
  • Donated
  • Association

Posted 22 November 2005 - 08:15 PM

Why not make it easier and combine the two databases into one?

#3 Detail

Detail

    King Detail

  • Hosted
  • 7,767 posts
  • Location:Dayonic
  • Projects:Dayvi.com
  •  Blu Spy

Posted 22 November 2005 - 09:17 PM

echo echo
A few other people said that, but it would still be very handy to know how to do this. So i can port information between databases in the future.

#4 Guest_ImmoMan_*

Guest_ImmoMan_*
  • Guests

Posted 22 November 2005 - 09:54 PM

Quickest thing would be to select the db twice and execute the query once after each select...

#5 Blodo

Blodo

    The one who disagrees

  • Project Team
  • 3,002 posts
  • Location:Eastern Europe
  • Projects:siteMeister, Mental Omega
  •  The wise guy

Posted 23 November 2005 - 12:04 AM

Open connection, insert query, close connection, open connection 2, insert query, close connection 2. Why complicate it further? :p

ARGUMENT FROM CREATION, a.k.a. ARGUMENT FROM PERSONAL INCREDULITY (I)
(1) If evolution is false, then creationism is true, and therefore God exists.
(2) Evolution can't be true, since I lack the mental capacity to understand it; moreover, to accept its truth would cause me to be uncomfortable.
(3) Therefore, God exists.


#6 Guest_ImmoMan_*

Guest_ImmoMan_*
  • Guests

Posted 23 November 2005 - 02:15 AM

Well, because he wants to use two databases on the same connection, I think... So he'd have to connect, select the db , execute a query, then select another db and execute the query again.

#7 Detail

Detail

    King Detail

  • Hosted
  • 7,767 posts
  • Location:Dayonic
  • Projects:Dayvi.com
  •  Blu Spy

Posted 23 November 2005 - 12:18 PM

:) If id of know it was this simple i'd not of asked :)

That's the problem with only learning from examples, there are not examples for everything i'd like to do :p

#8 Guest_ImmoMan_*

Guest_ImmoMan_*
  • Guests

Posted 23 November 2005 - 12:47 PM

That's the difference between knowing the examples and knowing the language. :)

#9 DCoder

DCoder

    One of the Few

  • Members
  • 331 posts
  • Location:Lithuania, Central Europe
  •  Old Grumpy Bastard

Posted 25 November 2005 - 02:58 PM

Can't you keep two connection ids and pass the necessary one as the second parameter in mysql_query()?
Ares - How do you want to improve YR today?
What's stopping you from migrating to Ares? We can't implement it unless you tell us!

ModEnc - C&C Modding Encyclopedia | Modders' Quote Database | Yet Another C&C Modding Forum

#10 Guest_ImmoMan_*

Guest_ImmoMan_*
  • Guests

Posted 25 November 2005 - 03:05 PM

Because, if you connect to the same server twice, PHP ends up re-using the connection. So that would only work on 2 distinct mySQL servers.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users