Announcement

Collapse
No announcement yet.

Need to connect to a remote database.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • JackG
    replied
    hehe thanks!

    I am still waiting for there responce.

    Here is what i am trying to do..
    I have a real estate listing service online.
    1 major site & 1 smaller one.

    I want:

    Site A to view both Site A's and Site B's data

    But Site A can only see Site A's data.

    So if you place a listing on site B it will appear only on site B

    But if you place a listing on site A your get a listing on both
    site A & B.


    Has anyone here done this?

    Leave a comment:


  • The Prohacker
    replied
    Well if the other IP is bound to the same server, you can still just use localhost.. Because MySql doesn't bind to a specific IP....

    Leave a comment:


  • Mark Hensler
    replied
    You can grant access to a specific user from a specific IP or hostname. It's just up to your host to make that decission. If they don't you might try badgering them.

    And if they play dumb, post back here and we'll give you the SQL queries to email them.

    Muhahaha!

    Leave a comment:


  • JackG
    replied
    I wrote to them lets see what happens.
    Its just my otehr IP that needs acces. i will post back.

    Leave a comment:


  • Kaizen
    replied
    Originally posted by JackG
    thanks I will ask them and see what happens.
    I dont think they will because it opens the server (and your databases) to attack.

    Leave a comment:


  • JackG
    replied
    thanks I will ask them and see what happens.

    Leave a comment:


  • Kaizen
    replied
    Your mysql may not be set up to allow external connections to the database.

    Contact your host.

    Leave a comment:


  • JackG
    replied
    hmmm. I am using this DB connction in a
    Common.php file. Added all the right data but get
    this error:


    Warning: MySQL Connection Failed: Access denied for user: '[email protected]' (Using password: YES) in /home/sites/site4/web/propview.php on line 7
    Couldn't connect to mySQL server


    So it looks like its not letting site A connect to the database on
    site B

    Do i need to give a permission to site A

    Any ideas?
    Last edited by JackG; Mon 26 Nov '01, 3:05pm.

    Leave a comment:


  • JackG
    replied
    Thanks- The Prohacker . I will give it a shot!

    Leave a comment:


  • The Prohacker
    replied
    PHP Code:

    $hostname 
    =  "255.255.255.255";  // host 
    $username =  "db_user";       // user 
    $password =  "db_pass";    // password 
    $dbName =  "db_name";      // dbname

    MYSQL_CONNECT($hostname$username$password) OR DIE( "Unable to connect to database");

    //Your stuff here

    MYSQL_CLOSE(); 

    Just change 255.255.255.255 to the IP or hostname of the mysql server....

    Leave a comment:


  • JackG
    started a topic Need to connect to a remote database.

    Need to connect to a remote database.

    NOT ABOUT VB BUT PHP HELP

    Hello,

    Here is the code I use to connect to a database n the same server:

    //MYSQL DATABASE SETUP
    $user = "username";
    $password = "xxxxxxx";
    $db = "db_name";
    $server = "localhost";

    Can anyone help me with the PHP code to
    connect to a DB on a different server entirly?

    Thanks in advance!
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X