Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2006
    Location
    Northern Ireland
    Posts
    307
    Tokens
    0

    Default Figure out this for me?

    Okay this is my problem I created a SQL database for my Radio Pannel and when I go to the intsaller this appears:

    Warning: mysql_connect() [function.mysql-connect]: Host '67.18.208.126' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts' in /home/habbosty/public_html/djp/staff/dj/sql.php on line 14
    Couldn't select database.

    I have to edit a file called sql.php which is like this:

    <?php
    //MySQL Hostname
    $hostname = '';
    //MySQL Database Username
    $sqlname = "'';
    //MySQL Database Password
    $sqlpass = '';
    //MySQL Database Name
    $mysqldb = '';
    $connection = mysql_connect($hostname, $sqlname, $sqlpass) or die("Couldn't select database.");
    $db = mysql_select_db($mysqldb, $connection) or die("Couldn't select database.");
    ?>

    Here are some connection strings I found on Cpanel:

    Connection StringsPerl$dbh = DBI->connect("DBI:mysql:habbosty_djpanelocalhost","habbosty_dj","<PASSWORD HERE>");PHP$dbh=mysql_connect ("localhost", "habbosty_dj", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("habbosty_djpanel");

    Can you use these to tell me what I have to place in the blank parts of the sql.php? Or what am I doing wrong?
    Post Count:

    50 100 200 500 1000

  2. #2
    Join Date
    Sep 2006
    Posts
    450
    Tokens
    0

    Default

    Before opening a site you really should learn something..

    [php]
    <?php
    //MySQL Hostname
    $hostname = 'localhost';
    //MySQL Database Username
    $sqlname = 'USERNAMETOCONNECT';
    //MySQL Database Password
    $sqlpass = 'PASSWORDTOCONNECT';
    //MySQL Database Name
    $mysqldb = 'PUTTHEDATABABASEHERE';
    $connection = mysql_connect($hostname, $sqlname, $sqlpass) or die("Couldn't select database.");
    $db = mysql_select_db($mysqldb, $connection) or die("Couldn't select database.");
    ?>

  3. #3
    Join Date
    Jun 2006
    Location
    Northern Ireland
    Posts
    307
    Tokens
    0

    Default

    What's the local host and Database name?
    Post Count:

    50 100 200 500 1000

  4. #4
    Join Date
    Sep 2006
    Posts
    450
    Tokens
    0

    Default

    Leave localhost as localhost and database name is the name of the database that the sql is located in, prefixed by your cpanel name, i.e. cpanellogin_databasename

  5. #5
    Join Date
    Jun 2006
    Location
    Northern Ireland
    Posts
    307
    Tokens
    0

    Default

    If I leave it as local host will it work?
    Post Count:

    50 100 200 500 1000

  6. #6
    Join Date
    Jun 2006
    Location
    Northern Ireland
    Posts
    307
    Tokens
    0

    Default

    Now this comes up:

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dj'@'localhost' (using password: YES) in /home/habbosty/public_html/djp/staff/dj/sql.php on line 14
    Couldn't select database.
    Post Count:

    50 100 200 500 1000

  7. #7
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492
    Tokens
    147

    Latest Awards:

    Default

    Read the yellow/orange bits i added

    PHP Code:
    <?php
    //MySQL Hostname
    $hostname 'localhost'//local host stays localhost
    //MySQL Database Username
    $sqlname 'USERNAMETOCONNECT'//username = ur username to log into cpanel or a certain user u made attached to the database.
    //MySQL Database Password
    $sqlpass 'PASSWORDTOCONNECT'//This is the password u use for loging into cpanel, or a certain pw u set up the the account u created attached to the database (if u did this, but u just us cpanel info)
    //MySQL Database Name
    $mysqldb 'PUTTHEDATABABASEHERE'//database name, this will be like "urcpanelUsername_databasename"
    $connection mysql_connect($hostname$sqlname$sqlpass) or die("Couldn't select database.");
    $db mysql_select_db($mysqldb$connection) or die("Couldn't select database.");
    ?>
    Last edited by [Oli]; 19-09-2006 at 05:53 PM.

  8. #8
    Join Date
    Jun 2006
    Location
    Northern Ireland
    Posts
    307
    Tokens
    0

    Default

    Thanks Oli That was really helpful + rep!
    Post Count:

    50 100 200 500 1000

  9. #9
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492
    Tokens
    147

    Latest Awards:

    Default

    Quote Originally Posted by Yamba View Post
    Thanks Oli That was really helpful + rep!
    No problem

Posting Permissions

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