Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: link in mysql

  1. #1
    Join Date
    Sep 2012
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Exclamation link in mysql

    hi every one can anyone help me in mysql HOW I CAN LINKE BETWEEN 2 DB WITH PHP OR MORE ?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Your post is unclear. We need more information. What does "link" mean?

    In short, you can create two different connections and use them as needed. There is nothing specifically difficult about this.

    Another question: why do you want to do this? In most cases, it's probably a bad idea. Sometimes (maybe to move information from one database to another) it might be ok, but not as the main way a website is built, probably.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:

    WAD ELEHEMER (10-17-2012)

  4. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Somewhat related question: Besides what you mentioned what would be a good reason to maintain two databases? The best I can think of is if a person has a very high traffic forum or has a backup database that is used while the primary one is down for updating or fixing so as to ensure that a website never has any downtime due to updates. That is a little beyond me though. I have a friend in IT that explained the usefulness of a backup database to me and that is how I understand it although it is still a bit beyond me.
    To choose the lesser of two evils is still to choose evil. My personal site

  5. The Following User Says Thank You to james438 For This Useful Post:

    WAD ELEHEMER (10-17-2012)

  6. #4
    Join Date
    Sep 2012
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    thunkx

    but i was mean like between two table in db with primary key so can we do that between two dbs

  7. #5
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Do the tables need to be separate? If so, why? It would be much easier to just put then in the table and use one primary key. Also, please try and use correct English while posting.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  8. The Following User Says Thank You to bernie1227 For This Useful Post:

    WAD ELEHEMER (10-18-2012)

  9. #6
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by WAD ELEHEMER View Post
    like between two table in db with primary key so can we do that between two dbs
    keys that link tables to each other are foreign keys, not primary keys.

    foreign keys can link 2 or more databases, but only when they're on the same host (or virtual host, or you've gone to some extreme effort to connect them).

    Although you could mimic the behavior using PHP, it would be complex and wouldn't work nearly as well as a native implementation.

    ------------------------------------
    As james asked, what are you trying to do?

    There's probably a better way to do it.

  10. #7
    Join Date
    Sep 2012
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Now I understand Thank you bernie1227

    and by the way I have a weakness in English, so accept my apologies for the construction errors

  11. #8
    Join Date
    Sep 2012
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by traq View Post
    keys that link tables to each other are foreign keys, not primary keys.

    foreign keys can link 2 or more databases, but only when they're on the same host (or virtual host, or you've gone to some extreme effort to connect them).

    Although you could mimic the behavior using PHP, it would be complex and wouldn't work nearly as well as a native implementation.

    ------------------------------------
    As james asked, what are you trying to do?

    There's probably a better way to do it.
    I was working at the site and it contains a set of separate databases need to work linking rules in the process of query for admin page far better to work i Chloe in a single database containing the set of tables .

    thank you

  12. #9
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Specifically:

    Are the databases identical (is one a backup for the other, or is it a distributed/ load balanced database), or do the two databases contain different information?

    Are the databases on the same host?

    If so, are the databases accessible on the same user account?

  13. #10
    Join Date
    Sep 2012
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by traq View Post
    Specifically:

    Are the databases identical (is one a backup for the other, or is it a distributed/ load balanced database), or do the two databases contain different information?

    Are the databases on the same host?

    If so, are the databases accessible on the same user account?
    it's not identical and contain different information also on the same host beside accessible on the same user account

Similar Threads

  1. Replies: 0
    Last Post: 01-04-2011, 01:17 PM
  2. Replies: 1
    Last Post: 12-13-2010, 09:21 PM
  3. Replies: 1
    Last Post: 10-20-2010, 06:18 AM
  4. Replies: 0
    Last Post: 03-12-2010, 11:52 PM
  5. Replies: 0
    Last Post: 03-07-2009, 07:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •