www.webdeveloper.com
Results 1 to 3 of 3

Thread: 2 databases in one page

  1. #1
    Join Date
    May 2011
    Posts
    46

    2 databases in one page

    Hello,

    Is it possible to make a connection from one domain for example mysite.com to 2 different databases in two different locations (mysite.com and mysite2.com).

    Thanks

  2. #2
    Join Date
    Jul 2006
    Posts
    128

    mySQL indexes

    I'm using mysql 5.0 with PHP 5.x and my problem is:
    I don't fully understand how they treat indexes.

    I am familiar with PROGRESS databases, as that is what I work with, and having read through the mySQL manual, I have a couple of questions:

    1. Comparing dates with > or < operators.
    If I have an index:
    col_1_text
    col_2_date
    col_3_other

    and build my WHERE clause as "col_1_text = 'a' AND col_2_date > some_date AND col_2_date < some_date AND col_3_other = other"
    will it use the index entirely, or only up to a certain point?

    The reason I ask is, PROGRESS DB's stop after comparing a date using a > or < operator. As a workaround, we use a date driver in the code so that we run multiple queries:
    "col_1_text = 'a' AND col_2_date = some_date AND col_3_other = other"
    then increment some_date and run it again.

    2. Would the "date driver" method be faster in any way?

    If anyone knows any more (good) literature on mySQL indexes, please direct me, as the actual manual was somewhat sketchy, and most online searches give me general data on how to use indices (indexes...watever)

  3. #3
    Join Date
    Apr 2003
    Location
    Rosemount, MN
    Posts
    2,287
    Yes, and assuming your using php, it would look something like this:

    PHP Code:
    $conn1 mysql_connect("mysite1.com""123""123");
    mysql_select_db("mydatabase1"$conn1);

    $conn2 mysql_connect("mysite2.com""123""123");
    mysql_select_db("mydatabase2"$conn2);

    mysql_query("select * from mytable1"$conn1);
    mysql_query("select * from mytable1"$conn2); 
    My settings

    Browser :: FireFox 1.5
    Resolution :: 1152x864
    Connection :: Cable Modem 2Mbs

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles