35 users online (0 members and 35 guests)  


  Results 1 to 3 of 3

Related

  1. FTP won't connect...    Forum: Databases
    Replies: 5
  2. How to connect to database mysql    Forum: Databases
    Replies: 1
  3. remote connect to Mysql    Forum: PHP Forum
    Replies: 8
  4. Unable to connect to database    Forum: CGI Perl Forum
    Replies: 2
  1. #1
    shyami's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2006
    Posts
    1

    i can connect, but i can't do anything

    Now i can get a connection, but i can't do anything with this connection
    whenever i attempt to select a database or tables,
    it saying permission denied, see my code once Plz


    $con=@mysql_pconnect("localhost","root","abcd");
    if (!$con)
    echo "<br>Unable to connect",mysql_error();
    else
    echo "<br>connected",mysql_error();

    $dbcon=@mysql_select_db("project",$con);
    if ($dbcon)
    echo "<Br>Database Selected";
    else
    echo "<br>Database not selected",mysql_error();


    I got this as a result


    connected
    Database not selectedAccess denied for user: 'root@localhost' to database 'project'



    the same thing happens in console also, what can i do?

    send a reply plz!!!!!!!!


    Shyami

  2. #2
    uthus's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Ft Hood
    Posts
    75

    Re: i can connect, but i can't do anything

    Hi,

    I use something like this for the db's I'm working on:
    Code:
    <?php
      $db=mysql_pconnect('localhost','user','passwd');
      if (!$db)
      {
        echo 'Error: Could not connect to database. Contact the Administrator.';
        exit;
      }
    mysql_select_db('database');
    $query = "insert into table values ('".firstvalue."', '".secondvalue."')";
    $result = mysql_query($query);
    .
    .
    .
    
    ?>
    hth,

    U

  3. #3
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: i can connect, but i can't do anything

    Try removing the '@' from the commands and see if there are any warnings that shed any more light on the matter.



Tags for this Thread