SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict ibeblunt's Avatar
    Join Date
    Jan 2001
    Location
    Jersey City, NJ
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do you connect to 2 different tables in 2 different databases, using PHP

    For example:

    db - vb114
    table - users
    field - userid

    db - sohh
    table - albums
    field - userid

    So they both share the same userid. I know how to do it when everything is in one db, but what about in two db's?


    <Edited by ibeblunt on 01-15-2001 at 12:07 AM>
    <///////~

    www.sohh.com

  2. #2
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,939
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can't access two DBs in a single query.

    If you really need to do this I'd suggest combining the DBs. There is no limit on the amount of tables you can have in one DB and they don't have to be for the same thing.

    then again... You can link foreign tables to a DB, but I don't know if that'd work... and its probably not possible in MySQL anyways.

    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  3. #3
    SitePoint Zealot Ace Nova's Avatar
    Join Date
    Aug 2000
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you absolutely have to you can use two queries and then combine the stuff.
    Ace Nova
    Football Man
    InternetSprite.Com - Coming Soon!

  4. #4
    SitePoint Addict ibeblunt's Avatar
    Join Date
    Jan 2001
    Location
    Jersey City, NJ
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, I just made 2 queries and combined the stuff. Wasn't the hardest thing to do. Might be a little tasking on the server but otherwise, it worked.
    <///////~

    www.sohh.com

  5. #5
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you've used ASP, it's a snap. Use one connection object, and run two separate RS.Open statments on it, Only changing the SQL statement. If your server has ASP capabilities I would reccommend this.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)


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
  •