Access denied when trying to access my database.
- by Sergio Tapia
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