MYSQL/PHP connection problem

Discussion in 'PHP' started by joewills, Feb 8, 2006.

  1. #1
    I can connect to my mysql database online using the following code which is stored in a folder within my domain name:
    (I have changed the username, password, db etc)
    <?php
    $username="dbo554776865";
    $password="CXfgFFet";
    $database="db554776865";
    $server_name="db378.oneandone.co.uk";
    $connection = mysql_connect($server_name,$username,$password);
    mysql_connect($server_name,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");

    ?>


    I want to be able to connect to this online database locally from my own computer. How can I do this please?

    at the moment I get this error message:

    Warning: mysql_connect(): Unknown MySQL Server Host

    Thanks,

    Joe
     
    joewills, Feb 8, 2006 IP
  2. arnek

    arnek Active Member

    Messages:
    134
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    does the user have rights to accesss the db from outside this server?
     
    arnek, Feb 8, 2006 IP
  3. joewills

    joewills Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Cheers Arnek,

    I didn't think of that. I just rang oneandone and I do not have access from outside the server, which sucks.

    Thanks though,

    Joe
     
    joewills, Feb 8, 2006 IP
  4. onlyican.com

    onlyican.com Peon

    Messages:
    206
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The hosting company should allow access from a percific IP address if you give it to them.

    But for security reasons, most hosting companies don't allow connection from another webhosting.
     
    onlyican.com, Feb 8, 2006 IP