Why am I getting this error?

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user ‘a4952887’@‘localhost’ (using password: NO) in /home/a4952887/public_html/login.php on line 3

[php]<?php

$username = mysql_real_escape_string($_POST[‘username’]);
$password = mysql_real_escape_string($_POST[‘password’]);

if ($username&&password)
{

$connect = mysql_connect(“mysql115.000webhost.com”,“a4952887_login”,“liljj45”) or die(“Couldn’t connect!”);
mysql_select_db(“a4952887_login”) or die(“Couldn’t find DB”);

}

?>[/php]

  1. if($username&&password) is incorrect, it must be $password
  2. How is it outputting an error if you are using die()?
  3. You are using a mysql string without connecting…

This one is true.

This is a valid point, but I would guess you are prob checking the error log.

No he isn’t. He has a mysql_connect and a mysql_select_db. The error you actually recieved, is one given if the username or password is wrong. From your error it also seems to be using localhost, but your code doesn’t say so. Change the host in your code to “localhost” and double check the user and password.

Sponsor our Newsletter | Privacy Policy | Terms of Service