Hey All,

I am having connection problems with phpmyadmin.
Since my friend had a username and password from the college, I did not have to download phpmyadmin software on my laptop. Instead, I could just go online and add tables for my site.

Therefore, I assume $db_host="localhost" is the one that is not letting me connect to phpmyadmin.
I have uploaded my files on the server, but my login page don't find connection to the tables in the phpmyadmin.

Need help.

    Below is the code that I have for my problem:
    <?
    $host = "euler.gcsu.edu/phpmyadmin";
    $username = "myusername";
    $password = "mypass";
    $db_name = "mydbname";
    $tbl_name = "members";

    mysql_connect ($host, $username, $password) or die ("can't connect");
    mysql_select_db($db_name) or die (mysql_error ());

    $myusername = $POST ['myusername'];
    $mypassword = $
    POST ['mypasword'];

    $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
    $result = mysql_query($sql);

    $count = mysql_num_rows ($result);

    if($count==1) {
    session_register("myusername");
    session_register("mypassword");
    header("location:login_success.php");
    }
    else {
    echo "Wrong Username or Password";
    }
    ?>

    When I try to login, the page displays "can't connect".

      phpMyAdmin is a web application used as a GUI to manage a MySQL server. It's just a bunch of PHP scripts - you can't connect to it.

      What you're connecting to is a MySQL server. If the MySQL server isn't installed on the same server where your PHP scripts are being executed, then yes... "localhost" is of course the wrong value for the host name.

      Not much we can do to help you, though, other than to suggest that you use the correct host name of the server where MySQL is running.

      EDIT: Also, please do not post the same issue across multiple threads.

        I was using $host = "euler.gcsu.edu/phpmyadmin" and the system did not work.
        But, I tried $host = "localhost" and it worked even though I am using phpmyadmin on my college server.
        Login on my site is perfect now.

          Write a Reply...