The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MySql

Discussion in 'General Discussion' started by mywheels, Dec 26, 2009.

  1. mywheels

    mywheels Registered

    Joined:
    Dec 26, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I am quiet new to Cpanel and webhosting. I have came across several question, from which many of them occurred since i dont have much experience.

    So my problem is that, on localhost i have created a database with some applications, and its working nicely, however, when i upload it to the server, i cant use it, and i cant connect to my database what i have made.

    <?

    $connection = mysql_connect("localhost","black","white");
    mysql_select_db("colors", $connection);

    ?>

    this is nicely working on localhost, but not on the server, how should i modify the coding that will work online? I think i need to write something instead of localhost, but i dont know what it should be.

    If you could tell me the formula, that would help me a lot...

    thank you

    Mywheel
     
  2. thewebhostingdi

    thewebhostingdi Well-Known Member

    Joined:
    Jan 10, 2008
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    16
    First of all you will have to create the database from your cPanel and then need to create the database user to gain access to the particular database and then try to connect your database. If you still fail then try to use the IP address of your MySQL server replace to localhost and have a try.
     
Loading...

Share This Page