Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

problem with m login script?

Discussion in 'Database Discussion' started by hullcalendar, May 30, 2011.

  1. hullcalendar

    hullcalendar Registered

    Joined:
    May 30, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    51
    hey guys, im new to PHP and im trying to use a login script that allows users to register and login to my site from my database.

    on my login/register pages i get this error

    Warning: mysql_pconnect() [function.mysql-pconnect]: Unknown MySQL server host 'host' (1) in /home/hullcale/public_html/dbConfig.php on line 12
    Error connecting to database.
    Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'hullcale'@'localhost' (using password: NO) in /home/hullcale/public_html/dbConfig.php on line 20

    Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/hullcale/public_html/dbConfig.php on line 20


    it seems like al my problems are from my page dbConfig.php on line 12 and 20, problem is i dont know how to edit them, here is the code from that page...

    things you may need to know is my databse is called hullcale_database, user is Admin, password is password, as for host im not actually sure where i get this from? any tips?!

    <?
    // Replace the variable values below
    // with your specific database information.
    $host = "localhost";
    $user = "UserName";
    $pass = "Password";
    $db = "dbName";

    // This part sets up the connection to the
    // database (so you don't need to reopen the connection
    // again on the same page).
    $ms = mysql_pconnect(host, $user, $pass);
    if ( !$ms )
    {
    echo "Error connecting to database.\n";
    }

    // Then you need to make sure the database you want
    // is selected.
    mysql_select_db($db);
    ?>
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,565
    Likes Received:
    438
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You could try this:

    <?
    // Replace the variable values below
    // with your specific database information.
    $host = "localhost";
    $user = "cPanelusername_admin";
    $pass = "Password";
    $db = "hullcale_database";

    // This part sets up the connection to the
    // database (so you don't need to reopen the connection
    // again on the same page).
    $ms = mysql_pconnect(host, $user, $pass);
    if ( !$ms )
    {
    echo "Error connecting to database.\n";
    }

    // Then you need to make sure the database you want
    // is selected.
    mysql_select_db($db);
    ?>
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. hullcalendar

    hullcalendar Registered

    Joined:
    May 30, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    51
    thanks for having a go, i will give that a try :) any idea what my 'localhost' would be?
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,565
    Likes Received:
    438
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Leave that part as is and you'll be fine. The Database is on localhost. ;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. hullcalendar

    hullcalendar Registered

    Joined:
    May 30, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    51
    well!! thanks to your help i have got rid of all my error messages however i still cant login or register, im going to check through my login page etc. but i may buy you again soon :)
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice