PHP MySQL access

Discussion in 'Databases' started by tdebenning, Dec 8, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have a very simple script that just tries to create a table in my new mysql database.

    Here is the code
    <?PHP

    $hostname = "mysql01.discountasp.net";
    $username = "validusername";
    $pwd = "apassword";
    $database = "valid mysql database string string";

    $query = "CREATE table TESTUSER (id INT, username TEXT, password TEXT);";
    print("<p>");
    print($database);
    print("<p>");

    print("Hello Tom here is the information you requested.");
    $databaselink = mysql_connect($hostname, trim($username), $pwd) or die("Connection to MySQL-server failed!");
    mysql_select_db($database,$databaselink);
    if(mysql_db_query($database,$query,$databaselink))
    {
    print("Created Table");
    }
    else
    {

    print("<p>Failed to create table.<p>");

    printvar("Database Host Name " . $database);
    printvar("The Query = " . $query);
    printvar("Database Link = " . $databaselink);
    printvar("Username = " . $username);
    printvar("Password = " . $pwd);
    $error = mysql_errno($databaselink);
    printvar("Error No = " . $error);
    $errordesc = mysql_error($databaselink);
    printvar("Error Description" . $errordesc);
    }
    mysql_close($databaselink);

    ?>

    I get the following error when running this code

    Error DescriptionAccess denied for user: 'validusername@%' to database 'planetcogco_mysqlConn'

    Does anyone have any idea what I have done wrong here or should I open a support ticket to help get this resolved?

    Tom DeBenning
     
  2. Oops my stupid mistake never mind
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page