SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    Norway
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Retrieve info from another database

    Hi,

    I have two sites with one database each and I would like to retrieve some information from the second database on the other website. Since I cannot connect to two databases, I was thinking of making a php file that prints the info I need and then connect to that file, but will this work?, is it good practice ? and/or are there any better ways to do this ?

    Thanks

  2. #2
    Forum Buyer
    Join Date
    Jun 2004
    Location
    United States
    Posts
    811
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Who says you can't connect to 2 databases?
    Founder/Admin of a pretty decent chat forum
    Download free winterboard themes for your iPhone
    I run sites powered by vbulletin and one about the HTC Jetstream.

  3. #3
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    Norway
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried once and got a lot of errors. I mean having two connections on the same page.

  4. #4
    Forum Buyer
    Join Date
    Jun 2004
    Location
    United States
    Posts
    811
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please post the code you used to connect and I'll help ya out.

    You could also connect with a seperate file and include it in the page. Heck you could connect and grab all the info and output it inanother file and then include it in your page
    Founder/Admin of a pretty decent chat forum
    Download free winterboard themes for your iPhone
    I run sites powered by vbulletin and one about the HTC Jetstream.

  5. #5
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    Norway
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I havent coded anything yet, I'll try do something now and get back to this topic when I have some errors to report

  6. #6
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    Norway
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just made a query where I choose the last 5 users registered from the other database and included the file in my first website and I got this error:

    mysql error: Table 'usr_br.news_module' doesn't exist

    Looks like the "new" query to the other database interferes with my first db connection because the correct table name would be "news_module" the usr_br is just the second database name..

  7. #7
    Forum Buyer
    Join Date
    Jun 2004
    Location
    United States
    Posts
    811
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    post - your - code

    You probably have a simple error in your SQL query but you're really making this process of helping you a lot longer than it has to be by not posting code.
    Founder/Admin of a pretty decent chat forum
    Download free winterboard themes for your iPhone
    I run sites powered by vbulletin and one about the HTC Jetstream.

  8. #8
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    Norway
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks but it works now


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
  •