Results 1 to 4 of 4
  1. #1

    quick php/mysql ?

    Just a real quicky, I am teaching myself how to code in php, and use mysql through it. I have come to a question that I haven't really gotten a definite answer for. Can you use 2 different mysql databases on the same page?

    If you can would you be so kind as to offer links as to where I could find any information on any special techniques required to do so if they exsist. Thank you
    LipWeb.Net
    "Less Lip More Service"
    Providing Quality Hosting at Fair Prices
    AIM: LipWebNet MSN: daniel[at]lipweb.net [color=red]

  2. #2
    Join Date
    Mar 2003
    Location
    PHP =)
    Posts
    110
    **** it slipped my mind
    im sure u can
    using teh connect and close fucntions i guess

  3. #3
    Join Date
    Jul 2002
    Posts
    148
    i havent tried this in a long time, but something like this should work according to the php manuals..

    PHP Code:
    $server1 mysql_connect("host""username""pass");
    $dbserver1 mysql_select_db("server1");
    $server2 mysql_connect("host2""username""pass");
    $dbserver2 mysql_select_db("server2");

    $query mysql_query("SELECT * FROM test"$server1); // server1

    $query2 mysql_query("SELECT * FROM Test2"$server2); // server2
    $res1 mysql_fetch_array($query); // $res1 is the array containing data from the test table
    $res2 mysql_fetch_array($query2); // $res2 is the array containg data from the Test2 table.
    echo "<pre>server1: <BR>" print_r($res1) . "<BR> server2:" print_r($res2) . "</pre>";

    mysql_close($server1);
    mysql_close($server2); 

  4. #4
    thanks for the help.
    LipWeb.Net
    "Less Lip More Service"
    Providing Quality Hosting at Fair Prices
    AIM: LipWebNet MSN: daniel[at]lipweb.net [color=red]

  5. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Related Posts from theWHIR.com

Posting Permissions

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