Announcement

Collapse
No announcement yet.

php and mysql

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • php and mysql

    I can't creat databases or tables! heres the code I am using to create a database called test_database and a table called email_info:
    <?php

    $connection = mysql_connect ("localhost", "myusername", "mypassword");
    if ($connection == false){
    echo mysql_errno().": ".mysql_error()."
    ";
    exit;
    }

    $result = mysql_create_db ("test_database");
    if ($result == false)
    echo mysql_errno() . ": " . mysql_error() . "
    ";

    $query = "create table email_info " .
    "(fullname varchar(255), email_address varchar(255))";
    $result = mysql_db_query ("test_database", $query);

    if ($result)
    echo "Table 'email_info' was successfully created!";
    else
    echo mysql_errno().": ".mysql_error()."
    ";

    mysql_close ();


    ?>

    Then when I run it, it says this:
    1044: Access denied for user: '[email protected]' to database 'test_database'
    1044: Access denied for user: '[email protected]' to database 'test_database'

    Am I doing this right?

  • #2
    can you connect to that databse using the same args via the command line?

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...
    X