Access denied when trying to access my database.

Posted by Sergio Tapia on Stack Overflow See other posts from Stack Overflow or by Sergio Tapia
Published on 2010-06-01T21:53:34Z Indexed on 2010/06/01 22:03 UTC
Read the original article Hit count: 294

Filed under:
|
|

Here's my code:

<html>
    <head>
    </head>

    <body>
        <?php 
            $user = mysql_real_escape_string($_GET["u"]);
            $pass = mysql_real_escape_string($_GET["p"]);

            $query = "SELECT * FROM usario WHERE username = '$user' AND password = '$pass'";

            mysql_connect(localhost, "root", "");
            @mysql_select_db("multas") or die( "Unable to select database");

            $result=mysql_query($query);
            if(mysql_numrows($result) > 0){
                echo 'si';
            }   
         ?>
    </body>
</html>

And here's the error I get when I try to run it

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\useraccess.php on line 7

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\xampp\htdocs\useraccess.php on line 7

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\useraccess.php on line 8

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\xampp\htdocs\useraccess.php on line 8

Warning: mysql_numrows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\useraccess.php on line 16

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql